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: 

Place tangent drawingdimension

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
rikard.nilsson
592 Views, 5 Replies

Place tangent drawingdimension

 

Hi,

 

I wonder if it's possible to place a dimension to tangent with Inventor API. If it is possible.. What kind of Geometry Intent should I use?

 

Regards

Rikard

 

 

 

 

Tangent Dim.JPG

 

5 REPLIES 5
Message 2 of 6
adam.nagy
in reply to: rikard.nilsson

Hi Rikard,

 

Could you please provide a sample document that has the dimension set up that way?

 

Also, if you have such a dimension you could investigate it throguh the API to see how its properties are set up:

http://adndevblog.typepad.com/manufacturing/2013/10/discover-object-model.html

 

Cheers, 



Adam Nagy
Autodesk Platform Services
Message 3 of 6
rikard.nilsson
in reply to: adam.nagy

Hi Adam,

 

Funny that I have never used that method to look at an object before. Thanks for the suggestion.

 

But I can't still find what kind of intent I need to use. The intentType I find is kParameterIntent on IntentTwo.

 

I have attached a very simple example with two dimensions. First dimesnion you find is the one I need to get programmed.

 

/Rikard

Message 4 of 6

Edge.TangentiallyConnectedEdges collection allows to get all edges required for this dimension.

Dimension2.PNG

 

The following VBA code illustrates the idea.

Select arc segment and then run the sample:

 

Sub TestDimension()
    'active doc
    Dim oDoc As DrawingDocument
    Set oDoc = ThisApplication.ActiveDocument
    Dim oSheet As Sheet
    Set oSheet = oDoc.ActiveSheet
    Dim oView As DrawingView
    Set oView = oSheet.DrawingViews.Item(1)
    
    'selected drawing line segment
    Dim oArcSegment As DrawingCurveSegment
    Set oArcSegment = oDoc.SelectSet.Item(1)
    
    'parent edge
    Dim oArcEdge As Edge
    Set oArcEdge = oArcSegment.Parent.ModelGeometry
    
    'list of all tangentially connected edges
    Dim oEdgeColl As EdgeCollection
    Set oEdgeColl = oArcEdge.TangentiallyConnectedEdges
    
    Dim oCurves As DrawingCurvesEnumerator
    Set oCurves = Nothing
    
    ' tangentially connected linear edges
    Dim oEdge1 As Edge
    Dim oEdge2 As Edge
    Set oEdge1 = oEdgeColl.Item(2)
    Set oEdge2 = oEdgeColl.Item(3)
    
    Dim oLine1 As DrawingCurve
    Set oCurves = oView.DrawingCurves(oEdge1)
    Set oLine1 = oCurves.Item(1)
    
    Dim oLine2 As DrawingCurve
    Set oCurves = oView.DrawingCurves(oEdge2)
    Set oLine2 = oCurves.Item(1)

    Dim oTG As TransientGeometry
    Set oTG = ThisApplication.TransientGeometry

    Dim intent1 As GeometryIntent
    Dim intent2 As GeometryIntent
    Set intent1 = oSheet.CreateGeometryIntent(oLine2)
    Set intent2 = oSheet.CreateGeometryIntent(oLine1, PointIntentEnum.kEndPointIntent)

    ' insertion point
    Dim x As Double
    x = oView.Left + oView.Width + 1
    Dim y As Double
    y = oView.Top
    Dim oPos As Point2d
    Set oPos = oTG.CreatePoint2d(x, y)

    Dim oGeneralDimensions As GeneralDimensions
    Set oGeneralDimensions = oSheet.DrawingDimensions.GeneralDimensions

    'aligned linear dimension
    Dim oDim As LinearGeneralDimension
    Set oDim = oGeneralDimensions.AddLinear( _
                oPos, intent1, intent2, _
                DimensionTypeEnum.kAlignedDimensionType)
    Beep
End Sub

 

 Hope you could customize it to suit your needs.


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

Message 5 of 6

Hi Vladimir,

 

I have not tested your code. But if your code creates the dimensions on the picutre you added then it is the wrong dimension. It seams like it is the wrong dimension when I read the code you added..

It is the dimension to the tangent of the arc I need. Look at my picture on the top..

 

/Rikard

Message 6 of 6

A-ha 🙂  Sorry, I looked to the dimensions in the dwg ...

There is no GeometryIntent points for this case.  

Non-associative workaround - project geometry to the drawing sketch, create desired dimension and retrieve it to the drawing view.

 


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

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

Post to forums  

Autodesk Design & Make Report