Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Ordinate Dimensions (Where Art Thou Intent?) :)

8 REPLIES 8
SOLVED
Reply
Message 1 of 9
Tiffany_Hayden_
645 Views, 8 Replies

Ordinate Dimensions (Where Art Thou Intent?) :)

I'm having a specific issue when using ordinate dimensions. 

 

Firstly, I am placing an ordinate dimension set based of a collection of centerlines.

 

 

 

 

        Set oCLCol = SortAngledCLCollection(oCLCol, "V")
'
        For Each oCL In oCLCol
            If oCL.StartPoint.Y > oCL.EndPoint.Y Then
                Set oAttachPoint1 = oCL.StartPoint
            Else
                Set oAttachPoint1 = oCL.EndPoint
            End If
            
            Set oAttachPoint1 = ThisApplication.TransientGeometry.CreatePoint2d(oAttachPoint1.X, oAttachPoint1.Y)
            Set oIntent1 = oSheet.CreateGeometryIntent(oCL, oAttachPoint1)
            Call oIntentCol.Add(oIntent1)
        Next
        
        
        Set oAttachPoint1 = ThisApplication.TransientGeometry.CreatePoint2d(oDrawView.Center.X, oDrawView.Center.Y + oDrawView.Height)
        
        
        
        Call oSheet.DrawingDimensions.OrdinateDimensionSets.Add(oIntentCol, oAttachPoint1, kAlignedToCurveDimensionType)

 

 

 

 

When I try to go given a centerline and match up weather or not the centerline has a ordinate dimension it doesn't seem to find it. When I delete the member from the set and add it manually back to the set the intent is found. But for some reason when I add them through the above code it doesn't seem to find the intent. I just wander if I am doing something odd. I have also tried to remove the "oAttachPoint1" to the create geometry and it still didn't seem to work and created a dim at each end of the centerline which is not what I'm wanting. This is rough code definitely not finished.

 

 

Below is what I was trying to put together to find the intent based off of the above set added to my drawing view. I'm manually selecting the centerline on the drawing view that has an ordinate dimension already attached. The purpose of this entire check is to make sure I am not duplicating ordinate dimensions. I'm creating ordinate dimension set automation and want to not cause duplication or dimensions on top of dimensions. 

 

 

 

Public Sub OrdinateDimTest()

    Dim oCLIn As Centerline: Set oCLIn = ThisApplication.CommandManager.Pick(Inventor.SelectionFilterEnum.kDrawingCenterlineFilter, "Select a Centerline.")
    Dim oIntentIn As GeometryIntent
    Dim oIntentIn2 As GeometryIntent
    Dim oAttachPoint1 As Point2d
    Dim oAttachPoint2 As Point2d
    Dim oWorkFeatureIn As Object
    Dim oOccIn As ComponentOccurrence
    Dim strFamIn As String
    Dim oDrawDoc As DrawingDocument: Set oDrawDoc = ThisApplication.ActiveDocument
    Dim oSheet As Sheet: Set oSheet = oDrawDoc.ActiveSheet
    Dim oDrawDims As DrawingDimensions: Set oDrawDims = oSheet.DrawingDimensions
    Dim oOrdDimSets As OrdinateDimensionSets: Set oOrdDimSets = oDrawDims.OrdinateDimensionSets
    Dim oOrdDimSet As OrdinateDimensionSet
    Dim oMembers As OrdinateDimensionsEnumerator
    Dim oMember As OrdinateDimension
    Dim oIntent As GeometryIntent
    Dim oCL As Centerline
    Dim oWorkFeature As Object
    Dim oOcc As ComponentOccurrence
    Dim oOccDoc As Document
    Dim strFam As String
    Dim blnAddMember As Boolean
    Dim oOrdDims As OrdinateDimensions: Set oOrdDims = oDrawDims.OrdinateDimensions
    Dim oOrdDim As OrdinateDimension
    
    If oCLIn.StartPoint.Y > oCLIn.EndPoint.Y Then
        Set oAttachPoint1 = oCLIn.StartPoint
    Else
        Set oAttachPoint1 = oCLIn.EndPoint
    End If
    
    Set oIntentIn = oSheet.CreateGeometryIntent(oCLIn, oCLIn.StartPoint)
    Set oIntentIn2 = oSheet.CreateGeometryIntent(oCLIn, oCLIn.EndPoint)
    
    
    For Each oOrdDim In oOrdDims
        Set oIntent = oOrdDim.Intent
        
        
        If oIntent.Geometry Is oIntentIn.Geometry Then
            Debug.Print "Here"
        End If
        
        If oIntent.Geometry Is oIntentIn2.Geometry Then
            Debug.Print "Here"
        End If
    
    
    Next
End Sub

 

 

 

 

 

 

Tiffany Hayden
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

8 REPLIES 8
Message 2 of 9

Hi @Tiffany_Hayden_.  Have you tried checking the GeometryIntent.IntentType to see if it is a geometry based intent?  If not, then the GeometryIntent.Geometry property will return Nothing.  And if the intent type is Point2d type, you could use the GeometryIntent.PointOnSheet property to get that Point2D object from the intent.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 9

@WCrihfield  I guess my concern is that I may not be adding the OrdinateDimensionSet correctly which is causing me not to find the intents associated with them. 

Tiffany Hayden
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

Message 4 of 9

@WCrihfield  The odd thing that I have found is that if I delete the member and add the member back clicking on the CL I'm using and then run my code to find the intent it is found no issue. So that points to the way I'm adding the OrdinateDimensionSet as being incorrect. 😞 

Tiffany Hayden
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

Message 5 of 9

@WCrihfield 

I even tried this 

 

        Set oCLCol = SortAngledCLCollection(oCLCol, "V")

        For Each oCL In oCLCol

            Set oAttachPoint2 = ThisApplication.TransientGeometry.CreatePoint2d(oCL.StartPoint.X, oCL.StartPoint.Y)
            Set oIntent1 = oSheet.CreateGeometryIntent(oCL, oAttachPoint2)
            Call oIntentCol.Add(oIntent1)
        Next
        
        
        Set oAttachPoint1 = ThisApplication.TransientGeometry.CreatePoint2d(oDrawView.Center.X, oDrawView.Center.Y + oDrawView.Height)
        
        Call oSheet.DrawingDimensions.OrdinateDimensionSets.Add(oIntentCol, oAttachPoint1, kAlignedToCurveDimensionType)

 

 

Still no intent was found. 

Public Sub OrdinateDimTest()

    Dim oCLIn As Centerline: Set oCLIn = ThisApplication.CommandManager.Pick(Inventor.SelectionFilterEnum.kDrawingCenterlineFilter, "Select a Centerline.")
    Dim oIntentIn As GeometryIntent
    Dim oAttachPoint2 As Point2d
    Dim oDrawDoc As DrawingDocument: Set oDrawDoc = ThisApplication.ActiveDocument
    Dim oSheet As Sheet: Set oSheet = oDrawDoc.ActiveSheet
    Dim oDrawDims As DrawingDimensions: Set oDrawDims = oSheet.DrawingDimensions
    Dim oIntent As GeometryIntent
    Dim oOrdDims As OrdinateDimensions: Set oOrdDims = oDrawDims.OrdinateDimensions
    Dim oOrdDim As OrdinateDimension
    
    
    Set oAttachPoint2 = ThisApplication.TransientGeometry.CreatePoint2d(oCLIn.StartPoint.X, oCLIn.StartPoint.Y)
    Set oIntentIn = oSheet.CreateGeometryIntent(oCLIn, oAttachPoint2)
    
    
    
    For Each oOrdDim In oOrdDims
        Set oIntent = oOrdDim.Intent
        
        If oIntent.Geometry Is oIntentIn.Geometry Then
            Debug.Print "Here"
        End If
    
    Next

end Sub

 

 

Tiffany Hayden
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

Message 6 of 9

Quick question...Why are you creating a new transient Point2D, based on the X & Y coordinates of the Centerline.StartPoint, instead of just using the Centerline.StartPoint directly, since it is already a Point2D type object?  Maybe that slightly more direct association is what is needed.  Another question...is this  'picked' OrdinateDimension part of an OrdinateDimensionSet, or have you specified an Origin for the DrawingView that the individual OrdinateDimensions are being referenced from?  I'm not 100% sure if it matters, but I'm pretty sure that the 'first' GeometryIntent that you supply in a set of them, when creating an OrdinateDimensionSet seems to be more important than the others, so maybe the first one is the only one that is really associated with 'geometry' while the others may just be Point2d based, I'm not sure.  I haven't done a ton of drawing dimension automation projects, because of the vast variety/diversity of stuff we make drawings for.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 7 of 9

Hi @Tiffany_Hayden_ 

You should create the geometry intent from the centerline, using

PointIntentEnum.kStartPointIntent

Or

PointIntentEnum.kEndPointIntent

As the second argument.

 

Example:

	For Each oCL In oCLCol
		Dim oIntent As GeometryIntent
		If oCL.StartPoint.Y > oCL.EndPoint.Y Then
			Set oIntent = oSheet.CreateGeometryIntent(oCL, PointIntentEnum.kStartPointIntent)
		Else
		        Set oIntent = oSheet.CreateGeometryIntent(oCL, PointIntentEnum.kEndPointIntent)
		End If
		Call oIntentCol.Add(oIntent)
	Next
Message 8 of 9

It looks like the problem I was having was a corrupt drawing view. After I deleted the drawing view and recreated it and ran my code it worked fine. 

Tiffany Hayden
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

Message 9 of 9

@JhoelForshav Thank you for the information. I didn't know that that was an option. It didn't fix the problem but I will use that! I had a corrupt drawing view that needed to be recreated. Guess it got tired of the automation I was throwing at it. Thanks again, have a great day! 

Tiffany Hayden
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report