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: 

Automate general dimension between 2 planes of a sub-assembly

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
Anonymous
529 Views, 2 Replies

Automate general dimension between 2 planes of a sub-assembly

Hello guys,

 

I'm trying to make a code that automates a general dimension between the XY- planes of a subassembly in the idw enviroment

The main assembly has been named: assembly1 and the subassemblies as Test:1 and Test:2

 

After some googling i found this code, unfortunaly i’m unable to get it to work

https://forums.autodesk.com/t5/inventor-customization/creating-a-dimension-between-two-workplanes-in...

 

See in the attachments for a visual explanation.

First : No Dimension

Second: The XY Planes of the sub-assemblies

Third: a generated general dimension between the two subassemblies.

 

the code so far:

 

Dim oDrawingDocument As DrawingDocument
oDrawingDocument = ThisApplication.ActiveDocument
oSheet = ThisApplication.ActiveDocument.ActiveSheet
oDrawingView = ActiveSheet.View("VIEW11").View

oAssemblyDocument = oDrawingView.ReferencedDocumentDescriptor.ReferencedDocument
oTG = ThisApplication.TransientGeometry

Dim oOcc As ComponentOccurrence = ThisApplication.ActiveDocument.ReferencedDocuments(1).ComponentDefinition.Occurrences.ItemByName("Test:1")
Dim oOcc1 As ComponentOccurrence = ThisApplication.ActiveDocument.ReferencedDocuments(1).ComponentDefinition.Occurrences.ItemByName("Test2:2")

Dim wp1 As WorkPlane = oOcc.Definition.WorkPlanes.Item("XY Plane")
Dim wp2 As WorkPlane = oOcc1.Definition.WorkPlanes.Item("XY Plane")

Dim centerLine1 As Centerline = Nothing
Dim centerline2 As Centerline = Nothing
centerLine1 = oSheet.Centerlines.AddByWorkFeature(wp1, oDrawingView)
centerline2 = oSheet.Centerlines.AddByWorkFeature(wp2, oDrawingView)

Dim wInt1 As GeometryIntent = oSheet.CreateGeometryIntent(centerLine1, PointIntentEnum.kStartPointIntent)
Dim wInt2 As GeometryIntent = oSheet.CreateGeometryIntent(centerline2, PointIntentEnum.kStartPointIntent)

Dim oDimPos As Point2d = oTG.CreatePoint2d(centerLine1.StartPoint.X - 2, centerline2.StartPoint.Y)

Dim oDim As GeneralDimension '= Nothing
oDim = oSheet.DrawingDimensions.GeneralDimensions.AddLinear(oDimPos, wInt1, wInt2, DimensionTypeEnum.kHorizontalDimensionType)

 

Help is really appreciated.

2 REPLIES 2
Message 2 of 3
WCrihfield
in reply to: Anonymous

I know of another approach to getting those lines to dimension between within your drawing view.

The DrawingView object has a couple of methods that you can use called "GetIncludeStatus", "SetIncludeStatus", "GetVisibility", & "SetVisibility".

You can use the SetIncludeStatus, then the SetVisibility to show the line on your drawing view that represents the plane.  Then you can dimension between them.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 3
Anonymous
in reply to: WCrihfield

Thank you very much. You pointed me in the right direction :). 

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

Post to forums  

Autodesk Design & Make Report