Apply two DimensionTypeEnum's to a dimension

Apply two DimensionTypeEnum's to a dimension

harvey_craig2RCUH
Advocate Advocate
442 Views
4 Replies
Message 1 of 5

Apply two DimensionTypeEnum's to a dimension

harvey_craig2RCUH
Advocate
Advocate

I wish to make this a diametric and a vertical dimension:

harvey_craig2RCUH_0-1729506511446.png

This is the main line in question, I would like to add kVerticalDimensionType to the DimensionTypeEnum but as you can see I already use that to make this diametric.

Dim SharpCornerDimension = genDims.AddLinear("SharpCornerDimension", oDrawingView.SheetPoint(1.2, 0.5), oIntersectionIntent, Detail_XAxis_Intent, kDiametricDimensiontype)

Is there a way for me to do both?

 

I have attached the files with the full rule included in the drawing.

 

Thanks,

Harvey

0 Likes
Accepted solutions (1)
443 Views
4 Replies
Replies (4)
Message 2 of 5

C_Haines_ENG
Collaborator
Collaborator

Are you able to set a dimension to two different styles normally? I don't think a dimension can be more than one dimension type. 

 

The Inventor Documentation doesn't mention being able to enter more than one. 

 

You can usually try putting multiple values into a slot like that by entering it like so:

{Enum1,Enum2,Enum3}

I doubt it will work for this but its worth a try. 

0 Likes
Message 3 of 5

harvey_craig2RCUH
Advocate
Advocate

Thanks for the attempt but no that didn't work.

 

I've tried simplifying by placing this on the main view but I get roughly the same result:

harvey_craig2RCUH_0-1729669933335.png

 

With the UI I select the exact same curves and give it the same options and it give me the correct result:

harvey_craig2RCUH_1-1729670214943.png

 

In my code my intent is the X axis, I don't see why Inventor doesn't see that as a line rather than a point and place the dimension in a perpendicular direction to it?

 

Thanks,

Harvey

0 Likes
Message 4 of 5

Michael.Navara
Advisor
Advisor
Accepted solution

You are not able to assign two dimension types. But after some investigation the result depends on correct arguments and its order. The picture bellow  show the order of selection for the code sample.

 

MichaelNavara_0-1729683717027.png

 

 

Dim drw As DrawingDocument = ThisDoc.Document
Dim drwSheet As Sheet = drw.ActiveSheet

Dim centerLine As Centerline = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingCenterlineFilter, "Select center line")
Dim c1 As DrawingCurve = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingCurveSegmentFilter, "Select curve perpendicular to center line").Parent
Dim c2 As DrawingCurve = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingCurveSegmentFilter, "Select curve which defines the intersection").Parent

Dim midPoint As Point2d = c1.Segments(1).Geometry.MidPoint

Dim centerLineIntent As GeometryIntent = drwSheet.CreateGeometryIntent(centerLine)
Dim drawingCurvesIntent As GeometryIntent = drwSheet.CreateGeometryIntent(c1, c2)

Dim textOrigin As Point2d = midPoint.Copy()
textOrigin.TranslateBy(ThisApplication.TransientGeometry.CreateVector2d(1, 0))

Dim dimension As LinearGeneralDimension = drwSheet.DrawingDimensions.GeneralDimensions.AddLinear(
    textOrigin,
    drawingCurvesIntent,
    centerLineIntent,
    DimensionTypeEnum.kDiametricDimensionType)

 

 

0 Likes
Message 5 of 5

harvey_craig2RCUH
Advocate
Advocate

Thank you Michael,

 

Very easy fix I just changed the order in my code and it worked perfectly.

 

Cheers again,

Harvey

0 Likes