Hello Everyone,
I'm new here and with NX journal, but had already read too much topics from this site(thanks!) and from Siemens documentation.
Now I'm trying to extract a material list from structure application, specific for Basic Design. Where the profiles(stiffener system) are created as Solid bodies inside the primary structure part.
Considering that I'm trying to get the length of this solid body, but don't now how.
The system create a spline that have the length information but I don't know how the spline and the solid body are connected internaly. Because I'm looping by all solid bodies, they have all attributes I need, and now is just missing the length.
I tryed looping by the edges of the solid body but there is too much edges and I don't know which one have the correct length.
Some images from the elements:
image1: https://drive.google.com/file/d/1VSN9avxKH9dUuN9WRCP5NDygQO6F1dL2/view?u...
image2: https://drive.google.com/file/d/1uvGxOTlqO-VP2iMGYMBtGRowrY5167ei/view?u...
Any idea how can I get the length or find the spline asociated with the solid body?
Thank you
re: get length of stiffener
Are you using the routing application?
No. It's the Basic Design
No. It's the Basic Design application for ship design.
re: get length of stiffener
Unfortunately, I'm not familiar with the ship design module. I see in your screenshots that it creates splines and bodies, does it create any other type of specialized feature?
Is the solid body created based on the spline? If so, you should be able to get the parent feature (spline feature) from the body feature and measure the spline length. But, I'd be surprised if there is not a better way to get what you need...
You might want to post your question in the Siemens programming forum. Someone there may have experience with the ship design module.
I'm sorry to take to long, I
I'm sorry to take to long, I was at hollidays.
I sent the question to GTAC as you suggest.
But any way asking your question, It seems that there is a feature stiffener Subsystem that make the link. Checking the information of the body and the spline It is posible to check that they are linked by the stiffener subsystem(17), but still don't know how get the information of this feature.
Images:
solid body info: https://drive.google.com/file/d/1BWIFA7b5g-rEx2U1RW-ytcw5-QPbq-3S/view?u...
spline info: https://drive.google.com/file/d/18UbqM5gQXjufCwqoythSab5VMPigRnYR/view?u...
Thank you in advance
Probably looping through the
Probably looping through the bodies is not helping.
What I do is looping through the features when I need something similar.
Try something like this:
For Each _obj As NXObject In workPart.Features.GetFeatures()
If _obj.GetType() Is GetType(Features.ShipDesign.StiffenerSystem) Then
'Cast body to StiffenerSystem
Dim stiffener_system As Features.ShipDesign.StiffenerSystem
Dim sub_system As Features.ShipDesign.SubSystems = Nothing
stiffener_system = CType(_obj, Features.ShipDesign.StiffenerSystem)
'Check if the StiffenerSystem has a SubSystem
Dim has_subsystem As Boolean = False
For Each child As Features.Feature In stiffener_system.GetChildren()
If child.GetType() = GetType(Features.ShipDesign.SubSystems) Then
has_subsystem = True
sub_system = child 'Here you get access to the sub_system
End If
Next
'Here we make a loop and get the parent features of the stiffener system.
For Each parent As Features.Feature In stiffener_system.GetParents()
lw.WriteLine(parent.GetType.ToString)
'one of the parents is a curve like feature
'the others probably a feature like a Deck and Deck SubSystem.
'From this curve feature you can take your requested length.
Next
End If
Next
It works!
Easternway,
Thank you very much for the example, helped me a lot!
In the beginning it was not working because the Spline is not a Parent. Then I tryed the GetEntities() method. And then the script could find the Spline asociated to the Stiffener System/subsystem.
Below you can find your example changed for my necesity.
Dim workPart As Part = theSession.Parts.Work
For Each _obj As NXObject In workPart.Features.GetFeatures()
If _obj.GetType() Is GetType(Features.ShipDesign.StiffenerSystem) Then
'Cast body to StiffenerSystem
Dim stiffener_system As Features.ShipDesign.StiffenerSystem
Dim sub_system As Features.ShipDesign.SubSystems = Nothing
stiffener_system = CType(_obj, Features.ShipDesign.StiffenerSystem)
'Check if the StiffenerSystem has a SubSystem
Dim has_subsystem As Boolean = False
For Each child As Features.Feature In stiffener_system.GetChildren()
If child.GetType() = GetType(Features.ShipDesign.SubSystems) Then
'getting length from subsystem
sub_system = child 'Here you get access to the sub_system
For Each ent As NXObject In sub_system.GetEntities()
If ent.GetType() Is GetType(Spline) Then
has_subsystem = True
Dim Spl As Spline
Spl = CType(ent, Spline)
lw.WriteLine("Subsystem data: " & ent.GetType.ToString & " - " & Spl.getlength())
'one of the parents is a curve like feature
'the others probably a feature like a Deck and Deck SubSystem.
'From this curve feature you can take your requested length.
End if
Next
End If
Next
'getting length from stiffener_system without subsystem
If Not has_subsystem Then
'Here we make a loop and get the child features of the stiffener system -> the SPLINES!
For Each ent As NXObject In stiffener_system.GetEntities()
If ent.GetType() Is GetType(Spline) Then
Dim Spl As Spline
Spl = CType(ent, Spline)
lw.WriteLine("stiffener_system data: " & ent.GetType.ToString & " - " & Spl.getlength())
'one of the parents is a curve like feature
'the others probably a feature like a Deck and Deck SubSystem.
'From this curve feature you can take your requested length.
End if
Next
End if
End If
Next
Then I find something like this.
********001754/A;1-EST_002
---
Subsystem data: NXOpen.Spline - 1839.99999995396
Subsystem data: NXOpen.Spline - 2800
Subsystem data: NXOpen.Spline - 3080.00000004734
Subsystem data: NXOpen.Spline - 1839.99999995396
Subsystem data: NXOpen.Spline - 2800
Subsystem data: NXOpen.Spline - 3080.00000004734
Subsystem data: NXOpen.Spline - 1839.99999995396
Subsystem data: NXOpen.Spline - 2800
Subsystem data: NXOpen.Spline - 3080.00000004734
Subsystem data: NXOpen.Spline - 5079.96706158389
Subsystem data: NXOpen.Spline - 2800
Subsystem data: NXOpen.Spline - 5076.9668463602
Subsystem data: NXOpen.Spline - 2800
stiffener_system data: NXOpen.Spline - 7949.70309548417
stiffener_system data: NXOpen.Spline - 7886.05142196118
stiffener_system data: NXOpen.Spline - 7776.98094024331
stiffener_system data: NXOpen.Spline - 7597.34361441001
stiffener_system data: NXOpen.Spline - 7295.97347994382
stiffener_system data: NXOpen.Spline - 6722.91252323439
Good to hear you solved it. I
Good to hear you solved it. I expected the spline to be a parent, but apparently not.