Page 1 of 1

sectionFiber - zi, Ai

Posted: Fri Jan 17, 2025 11:39 am
by giulio.zanellato
Hi, I want to create or change the parameters of a fiber section using Python. How can I assign the corresponding values ​​of zi, yi, and the fiber area to an already created section? The intent is to automate the process of entering these fiber parameters for a calibration. I also attach the STKO model: there will be the fiber section with ID=87 that will be composed of 120 fibers. The section was created manually. What do I do if I want to change the parameters of that section using a Python script and without having to manually change the section?

I tried to write a script to add a single fiber with Python but it still gives me errors.

Script: see folder down
---------------------------------------------------------------------------------------------------
TERMINAL:
Clearing existing fibers...
Adding a single fiber to the section...
Committing changes to the fiber section...
Regenerating visual representation...
Calling regenerateVisualRepresentation() after adding fibers...
Error - SectionRebars(Rebars) RegenerateVisualRepresentation() called with Invalid state
Visual representation regenerated successfully after changes.
Updated fiber section ID 87 with a single fiber.

Re: sectionFiber - zi, Ai

Posted: Thu Feb 06, 2025 3:35 pm
by STKO Team
The code where you were defining the punctual fiber is wrong.
This is how it works:

Code: Select all

        # Add a single fiber
        print("Adding a single fiber to the section...")
        # this defines the geom (a vertex or and edge for multiple rebars)
        rebar_y = 0.0
        rebar_z = 0.0
        single_fiber_geom = FxOccBuilder.makeVertex(rebar_y, rebar_z, 0.0)
        # this is the name,not important
        single_fiber_name = 'a name'
        # build the fiber group
        single_fiber = MpcBeamFiberSectionPunctualFiberGroup(single_fiber_name, single_fiber_geom)
        # set the material, the material should be a reference to the MpcProperty, not the index
        single_fiber.material = doc.getPhysicalProperty(26)
        # define the edge data
        single_fiber_data = MpcBeamFiberPunctualEdgeData()
        single_fiber_data.inputType = MpcBeamFiberPunctualEdgeDataInputType.ByNumber
        single_fiber_data.diameter = 24.763359
        single_fiber_data.number = 1
        single_fiber.edgeData = single_fiber_data
        # done
        fiber_section.addPunctualFiber(single_fiber)
https://asdeasoft.github.io/STKO-Python ... c/Mpc.html