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
Solved! Go to Solution.
Solved by Vladimir.Ananyev. Go to Solution.
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,
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
Edge.TangentiallyConnectedEdges collection allows to get all edges required for this dimension.
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.
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
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.