Using FdScript to set calculation/design parameters to an element with guid [SOLVED]

Hello,
I would like to ask if I understand FdScript correct.
Marco said this could be used to set parameters that is not available in API se post:
Discussion on FdScript

If I would like to change crack width a Fdscript, it would look something like this?

<‘cmdconfig command=“$ MODULECOM APPLYCFG”>
<’!-- EUROCODE CALCULATION PARAMETERS CONCRETE SHELL →
<'CONFIG face_0_rCwLimit=“0.2” face_1_rCwLimit=“0.2”>
<‘GUID>2e290437-e86a-4e36-af7d-acde6a6146c8
<’/CONFIG>
<‘CONFIG face_0_rCwLimit=“0.3” face_1_rCwLimit=“0.3”>
<‘GUID>2cba9c00-255d-4258-94fb-f164aafff214
<’/CONFIG>
<’/cmdconfig>

That would be run in c# like this?

FemDesignConnection.SetConfig(string filepath)

I interpret that as the analysed structure needs to be static.
Having the API creating the object will cause a new randomly generated guid every time API is run, causing guid given in the Fdstript to be “out of date”?

ehi @KPN !

Depending on your case study, you can do something like the following to statically set the Guid of an object.
As a note, Fdscript Guid always refer to the analytical Guid which is the one on the attribute.

slab.Guid = new Guid( "{F42D2623-FB17-4F39-9A21-EDDA24944298}");
slab.SlabPart.Guid = new Guid("{A951B736-3394-4FE4-B38F-D17F1161EB3A}");

If needed, we can implement the features so that you can use it by C#.
In that way, you can avoid in creating the text file manually.

1 Like

Sorry in advance for long post :sweat_smile:
I have done an honest attempt even if I find quite a lot of work learning a different coding concept with separate files just to do a thing, I think is quite essential for concrete construction.

In element creation:

// Set static Guid
SlabBPL.SlabPart.Guid = new Guid(“A951B736-3394-4FE4-B38F-D17F1161EB3A”);
SlabMUR.SlabPart.Guid = new Guid(“F42D2623-FB17-4F39-9A21-EDDA24944298”);
SlabBPLMUR.SlabPart.Guid = new Guid(“2E290437-E86A-4E36-AF7D-ACDE6A6146C8”);

FdScript:

<?xml version="1.0" encoding="UTF-8"?>
<fdscript xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="fdscript.xsd">
  <!-- SCRIPT HEADER  ==================================================================================  -->
  <fdscriptheader>
    <title>FEM-Design Test script</title>
    <version>2300</version>
    <module>SFRAME</module>
    <!-- log file where warnings from calculation and other interesting entries may appear -->
    <logfile>C:\Users\kpn\VS local\FemDesign.KPN\RetainingWall\Test.log</logfile>
  </fdscriptheader>

	<!-- SCRIPT	CONFIGURATIONS  ==================================================================================  -->
  <cmdconfig command="$ MODULECOM APPLYCFG">
  	<!-- EUROCODE CALCULATION PARAMETERS CONCRETE SHELL -->
  	<!-- Face_0 = UK	Face_1 = OK -->
  	<!-- BPL -->
  	<configs>
  		<CONFIG face_0_rCwLimit="0.25" face_1_rCwLimit="0.30">
			<GUID>A951B736-3394-4FE4-B38F-D17F1161EB3A</GUID> 
  		</CONFIG>
  		<!-- MUR -->
		<CONFIG face_0_rCwLimit="0.35" face_1_rCwLimit="0.40">
  			<GUID>F42D2623-FB17-4F39-9A21-EDDA24944298</GUID>
  		</CONFIG>
		<!-- BPLMUR -->
		<CONFIG face_0_rCwLimit="0.45" face_1_rCwLimit="0.50">
			<GUID>2E290437-E86A-4E36-AF7D-ACDE6A6146C8</GUID>
		</CONFIG>
	</configs>
  </cmdconfig>

  <!-- END SESSION 	===================================================================================  -->
</fdscript>

Exported config file:
cfg.xml (25.4 KB)
.Struxml file:
Retainingwall.struxml (108.2 KB)

When testing I used Fem-Design Console Tab Tools -> Run script

Error massage in log:

step: cmdconfig
t: 02/07 15.44.10.354
cmdconfig:‘$ MODULECOM APPLYCFG’
element expected
t: 02/07 15.44.10.355
aborting script execution
Script file finished

Have you any clue what can be wrong with my FdScript?

Sidenote: In bridge construction exposure class is important as surfaces often is subjected to water or chlorides. Example in road environment leading to affecting reinforcement needed for design. I asked my colleague that works designing buildings and according to him crack width is also relevant for him when designing foundation and other concrete surfaces that can be subjected to water/chlorides (even if the corrosive environments are more important in bridge design).

In conclusion, cracks are important for most reinforcement design and can affect utilization rate. Therefore, my opinion is that crack width should be easy to control within the API.
Feels like it relates to this old post about setting “design parameters”.
Maybe setting crack width can be implement at the same time? :blush:

Workflow to design a retaining wall through the API #1116

Ehi @KPN

Thanks a lot for the explanation.

The API has some “holes” in the design/calculation settings and it seems that we should improve some aspect :slight_smile:

I will try to squeeze in some development so that you can programmatically create the fdscript by C#.

However, I have done some little test and it seems to work on my side.

NOTE

  • You need to have matched GUID in the .struxml and .fdscript (slabpart)

  • Use the type attribute (i.e. type="ECCALCPARAMSHELLRC")

  • You can omit some attribute if you do not want to set a new value

  • Remember to open the file through .fdscript using cmdopen

Let me know if it is working for you :slight_smile:

setCalculationParameters.zip (9.9 KB)

1 Like

Thanks for your help!
Now the .FdScript work if I run it with Tools -> Run script :slight_smile:
SetCrackwidth.zip (947 Bytes)
But when the script is run though the API with FemDesignConnection.SetConfig(string filepath) I get the following error message (with a bunch of other message of successful script runs “Script file finished”):

cmdconfig:‘$ MODULECOM APPLYCFG’
<'CONFIG> element expected
t: 02/10 17.03.11.914
aborting script execution

Hmm I find SetConfig.fdscript in folder C:\Users\kpn\VS local\FemDesign.KPN\RetainingWall\scripts with code:

<?xml version="1.0" encoding="utf-8"?>
<fdscript xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <fdscriptheader>
    <title>FEM-Design script</title>
    <version>2300</version>
    <module>SFRAME</module>
    <logfile>C:\Users\kpn\VS local\FemDesign.KPN\RetainingWall\logfile.log</logfile>
  </fdscriptheader>
  <cmdconfig command="$ MODULECOM APPLYCFG" file="C:\Users\kpn\VS local\FemDesign.KPN\RetainingWall\SetCrackwidth.Fdscript" />
</fdscript>

For me it looks like it should work the same as running the file manually.
How did you run your .FdScript from the API?

1 Like
<?xml version="1.0" encoding="UTF-8"?>
<configs>
	<CONFIG face_0_rCwLimit="0.25" face_1_rCwLimit="0.15" type="ECCALCPARAMSHELLRC">
			<GUID>dadc75a8-1d7f-4b64-9334-2f84c4c0791f</GUID>
    </CONFIG>
    <CONFIG face_0_rCwLimit="0.50" face_1_rCwLimit="0.80" type="ECCALCPARAMSHELLRC">
        <GUID>65d12119-eb0c-48a0-b4bf-f50827031b52</GUID>
    </CONFIG>
</configs>

is your cfg.xml file looking like this?

it should only be a series of CONFIG within a configs xmlelement.
It works on my side

Have edit cfg.xml in the project folder so it matches the .FdScript
C:\Users\kpn\VS local\FemDesign.KPN\RetainingWall
Is this the correct? I also see that there is a cfg.xml in:
C:\Users\kpn\VS local\FemDesign.Core\Calculate\Config

<?xml version="1.0" encoding="UTF-8"?>
<configs>
	<!-- Face_0 = UK	Face_1 = ÖK -->
	<!-- BPL -->
		<CONFIG face_0_rCwLimit="0.25" face_1_rCwLimit="0.30" type="ECCALCPARAMSHELLRC">
			<GUID>A951B736-3394-4FE4-B38F-D17F1161EB3A</GUID>
		</CONFIG>
		<!-- MUR -->
		<CONFIG face_0_rCwLimit="0.35" face_1_rCwLimit="0.40" type="ECCALCPARAMSHELLRC">
			<GUID>F42D2623-FB17-4F39-9A21-EDDA24944298</GUID>
		</CONFIG>
		<!-- BPLMUR -->
		<CONFIG face_0_rCwLimit="0.45" face_1_rCwLimit="0.50" type="ECCALCPARAMSHELLRC">
			<GUID>2E290437-E86A-4E36-AF7D-ACDE6A6146C8</GUID>
		</CONFIG>
</configs>

Is this run? I still get the same error message.

For anyone interested in the issue.

The user was calling SetConfig(filePath) where filePath was actually an fdscript file.

Below, the correct way to set calculation/design parameters using the CONFIG

// Set crack width
var configFilePath= "cfg.xml";
ReinforcementDesignFEM.SetConfig(configFilePath);

where cfg.xml

<?xml version="1.0" encoding="UTF-8"?>
<configs>
	<!-- Face_0 = UK	Face_1 = ÖK -->
	<!-- BPL -->
		<CONFIG face_0_rCwLimit="0.25" face_1_rCwLimit="0.30" type="ECCALCPARAMSHELLRC">
			<GUID>A951B736-3394-4FE4-B38F-D17F1161EB3A</GUID>
		</CONFIG>
		<!-- MUR -->
		<CONFIG face_0_rCwLimit="0.35" face_1_rCwLimit="0.40" type="ECCALCPARAMSHELLRC">
			<GUID>F42D2623-FB17-4F39-9A21-EDDA24944298</GUID>
		</CONFIG>
		<!-- BPLMUR -->
		<CONFIG face_0_rCwLimit="0.45" face_1_rCwLimit="0.50" type="ECCALCPARAMSHELLRC">
			<GUID>2E290437-E86A-4E36-AF7D-ACDE6A6146C8</GUID>
		</CONFIG>
</configs>
1 Like

Thank for all your help Marco!
I will try to summary what I learned.
Maybe it will help someone else :slight_smile:
If I would do some other configuration setting with API I would follow this steps:

  1. Set the desired configurations and use the following command in Fem-Design

; CXL MODULECOM WXMLCFG:C:\temp\cfg.xml

Alternatively start with the cfg.xml described in link: FdScript | FEM-Design API

  1. Edit the cfg.xml file so it only includes configurations I want to change. Example of structure:
<?xml version="1.0" encoding="UTF-8"?>
<configs>
	<!-- Face_0 = UK	Face_1 = ÖK -->
	<!-- BPL -->
		<CONFIG face_0_rCwLimit="0.25" face_1_rCwLimit="0.30" type="ECCALCPARAMSHELLRC">
			<GUID>A951B736-3394-4FE4-B38F-D17F1161EB3A</GUID>
		</CONFIG>
		<!-- MUR -->
		<CONFIG face_0_rCwLimit="0.35" face_1_rCwLimit="0.40" type="ECCALCPARAMSHELLRC">
			<GUID>F42D2623-FB17-4F39-9A21-EDDA24944298</GUID>
		</CONFIG>
		<!-- BPLMUR -->
		<CONFIG face_0_rCwLimit="0.45" face_1_rCwLimit="0.50" type="ECCALCPARAMSHELLRC">
			<GUID>2E290437-E86A-4E36-AF7D-ACDE6A6146C8</GUID>
		</CONFIG>
</configs>
  • All configs needs a type.
  • Part specific configs needs a guid
  • Guid of slabs can be extracted with Slab.Slabpart.Guid or can be seen in the .Struxml file.
  • Comments can be given with <!-- XXX -->
  1. Implement the configuration in API with:

String filepath = “cfg.xml”;
FemDesignConnection.SetConfig(string filepath)

Maybe a cofig setting could be listed under FemDesign.Examples?
Or maybe this post is enough.

1 Like

Let’s go for a C# example in our repository :slight_smile:

Thanks for your feedbacks.

FYI:
We will implement those ConfigSettings so that you can avoid using the xml file.
We want our users to be able to do something like:

new calcShellRc = new CALCPARAMSHELLRC( foo, foo1, foo2 );
new calcShellRc = new CALCPARAMSHELLRC( foo, foo1, foo2 );
var config = new Config(calcShellRc );

connetion.Setconfig(config);

I will keep you update when this is possible!

1 Like