How to Check if A DrawingDimension from a DrawingView is A FlatPattern Extent Width or Length (not using iLogic)

How to Check if A DrawingDimension from a DrawingView is A FlatPattern Extent Width or Length (not using iLogic)

inulobo
Advocate Advocate
738 Views
5 Replies
Message 1 of 6

How to Check if A DrawingDimension from a DrawingView is A FlatPattern Extent Width or Length (not using iLogic)

inulobo
Advocate
Advocate

I am able to check if a view is a Flat pattern using oDwgView.IsFlatPatternView but how do I actually check the extents of the Flat pattern. I am cycling through all dimensions on a sheet. I just want to verify that I have dimensions that are the length and width. I am using VBA not iLogic.

0 Likes
Accepted solutions (1)
739 Views
5 Replies
Replies (5)
Message 2 of 6

WCrihfield
Mentor
Mentor
Accepted solution

The dimension itself will not have any sort of property that will tell you if it is the overall length or width of a FlatPattern.  The only way to accurately guess if the dimension is either the FlatPattern Length or the FlatPattern Width is to retrieve those measurement values from the model document (being represented in the view) and compare them to the dimension's parameter values.  If they match, we can assume the dimension is representing one of those two FlatPattern properties.  There are multiple ways of obtaining those measurements.  One way is to simply access the specific iProperties for those values (there are several just for sheet metal and flat patterns).  Since you are using VBA, that's likely the easiest route, and the one I would recommend.  If you set up a reference to the "Autodesk.iLogic.Interfaces.dll" you could try using that to get these values.  Or you can dig down into the referenced model document deeper and after defining the SheetMetalComponentDefinition, you cat dig up those values the hard way.

 

Here is a resource that will help you find those iProperties.

 

If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click 'LIKE' 👍.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 6

inulobo
Advocate
Advocate

That is exactly what I am trying to do. I cannot figure out how to access the iproperties of the specific view. They show up blank. The code I am using you can find below. I am not trying to create custom variables in the part file.

 

 

 

If oDwgView.IsFlatPatternView = True Then
Dim oProp As Property
Set oProp = oDrwDoc.PropertySets.item("Design Tracking Properties").item("Description")
                                        
Dim oLength As String
Dim oWidth As String
                                        
oWidth = oProp.Parent.item(44).Value
oLength = oProp.Parent.item(45).Value

End If

 

 

 

 

0 Likes
Message 4 of 6

WCrihfield
Mentor
Mentor

Here is some quickie VBA code that should point you in the right direction, as far as getting those iProperties.

It's not a complete solution, because I'm on my way out for the day, but it should show you enough.

Dim oDDoc As DrawingDocument
Set oDDoc = ThisApplication.ActiveDocument

Dim oSheet As Inventor.Sheet
Set oSheet = oDDoc.ActiveSheet

Dim oViews As DrawingViews
Set oViews = oSheet.DrawingViews
Dim oView As DrawingView

Dim oDDims As DrawingDimensions
Set oDDims = oSheet.DrawingDimensions
Dim oDDim As DrawingDimension

Dim oViewDoc As Document
Dim oDTProps As Inventor.PropertySet
Dim oFPWidth As Double
Dim oFPLength As Double

For Each oView In oViews
    If oView.IsFlatPatternView Then
        Set oViewDoc = oView.ReferencedDocumentDescriptor.ReferencedDocument
        Set oDTProps = oViewDoc.PropertySets.Item("Design Tracking Properties")
        Set oFPWidth = oDTProps.Item("Flat Pattern Width").Value
        Set oFPLength = oDTProps.Item("Flat Pattern Length").Value
        Exit For
    End If
Next

'Find a way to connect the DrawingDimension to that specific DrawingView then
If oDDim.ModelValue = oFPWidth Then
    'this dimension is the width dimension
ElseIf oDDim.ModelValue = oFPLength Then
    'this dimension is the Length dimension
Else
    'this dimension is niether
End If

If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click 'LIKE' 👍.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 5 of 6

_dscholtes_
Advocate
Advocate

If you didn't conclude it already from the code @WCrihfield posted: drawing views do NOT have iproperties. Documents have iproperties, so you need to get to the document of the model in the drawing view.

0 Likes
Message 6 of 6

inulobo
Advocate
Advocate

Yeah it was super hard for me to figure it out and I tried many different methods I had to do something like this:

Dim oPop As Inventor.Document
Set oPop = oDwgView.ReferencedDocumentDescriptor.ReferencedDocument
Dim oPopSet As PropertySet
Set oPopSet = oPop.PropertySets.item("Design Tracking Properties")
Dim oWidth As Inventor.Property
0 Likes