I am trying to find what formulas are being used for Dimensions in a Solid Edge Part or SheetMetal file. In the UI for the Variable Table they are considered type = Dimension and they are Named By = System.
In the API the SolidEdgeDocument.Variables does not return Dimensions. It appears to return only Variables defined by the user or variables created by the system (material thickness, PhysicalProperties_Density, MinimumArcLength, ect.)
Is there a simple way to get all of the Dimensions used in a model? Or do I need to go through each feature and each profile and retrieve them from there?
S&C Electric Company
Solved! Go to Solution.
Carl, You are perhaps right.
Either you can create extra user variables for each dimension variables and then access them through:
Dim oApp As SolidEdgeFramework.Application = Marshal.GetActiveObject("SolidEdge.Application") Dim oDoc As SolidEdgePart.PartDocument = oApp.ActiveDocument For Each oVar As SolidEdgeFramework.variable In oDoc.Variables Console.WriteLine("Name: " + oVar.DisplayName + ", " + "Formula: " + oVar.Formula) Next
Or as you said, loop through, all not just features, but also the sketches:
For Each oSketch As SolidEdgePart.Sketch In oDoc.Sketches For Each oProfile As SolidEdgePart.Profile In oSketch.Profiles For Each oDim As SolidEdgeFrameworkSupport.Dimension In oProfile.Dimensions Console.WriteLine(oDim.VariableTableName + ", " + oDim.Formula) Next Next Next
you don't need to iterate through all features. The Variables collection gives you with the Query method all you need.
Please check out my answer with VB code to another thread (How to obtain Variable table values of a Sheet Metal?).
Martin. That was perfect. I didn't know about the query method to create a variable list.
I have everything I need with a lot less work.