I trying to target dimensions on a draft document.
The draft is created (in batch through API) using Quicksheets.
The model views on the quicksheet refer the PMI views of the part.
The part also has my target PMI dimensions.
These PMI dimensions (in the part) have been named to be targetting.
In my macro, I am scanning through all dimensions in the draft document and would like to;
know how can I trace the draft dimension back to the PMI dimension in the part?
Dim objDraftDoc as SolidEdgeDraft.DraftDocument = objSolidEdgeApp.ActiveDocument Dim objSheet as SolidEdgeDraft.Sheet = objDraftDoc.Sheets.Item(0) Dim objDimensions as SolidEdgeFrameWorkSupport.Dimensions = objSheet.Dimensions Dim objDim as SolidEdgeFrameWorkSuppport.Dimension = Nothing For each objDim in objDimensions If objDim.< how could I trace back to the parts' PMI dimension > = "TheChosenPMI" Then '<do my things here> End If Next
Any help is much appreciated.
I don't know of any way to get this back link, but you can try to start investigating the following:
Each Dimension on a sheet is attached to a 2d geometry, e.g. DVLine2d, DVCircle2d, etc. You will get the attached object through the Related.Object property.
From the DVCircle2d object you can then get the ModelMember, which gives you the ComponentName (e.g. DesignBody) and the FileName of your part document.
You may then look for a PMI dimension in that document with the same type and value as the 2d Dimension object.
Other than that, I have no idea to achieve your goal.
Thank you very much Martin
I have been trying to something very similar.
Can you review the attached image to see and give me any sort of hint where I should dig deeper.
Digging into the seDVPoint2d (through the GetRelated()) I am able to find the part file and its PMI dimensions collection;
myObj-> ImmediateParent-> ModelLink-> PMI-> Dimensions
but opening up the objDimension object itself has not given me a clue to link it to the corresponding PMI.
I will keep looking to find an identifier.
You may check, if the Dimension in the draft is measuring the same type (radius, diameter, angle, distance) as the PMI Dimension and then compare the values.
Look for the DimensionType property in both dimensions and the number of referenced objects, e.g. a diameter dimension is referencing either a single edge or face in 3d and a single DVCircle2d object in 2d.
A distance dimension may either reference a single entity, e.g. length of an edge, or two entities, e.g. when measuring the distance between two faces/edges.
That may partially solve the problem but,
my target drawing has plenty of dimensions,
almost all of them linear,
and quite a few even have the same (dimensioned) 'value'.
Of the dimension object in the draft document; neither the SystemName, Name, VariableTableName or DisplayName (which are all the same) lead no clues to the PMI Dimension of the part.
Maybe if I compare values of "AbsoluteTrackDistance", "BreakDistance", "BreakPosition", "DimensionType", "LeaderDistance", "TerminatorPosition" AND "Value" of the two (PMI Dimension of PartDocument and the Dimension object in the DraftDocument (Sheet)), then maybe I could colreate the two.
I hopeful that would be an exposed key/indicator which SE uses to relate the two.
As an FYI: the dimension in the draft does update if you change the PMI dimension in the part. Thus it does seem to maintain a link. Unless it is just a unidirectional push and the DrawingView (including the Dimensions/Annotations) is regenerated everytime the DraftDocument is updated (?).
Thank you again