Message 1 of 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm trying to automate creating some dimensions for my drawings. I got to the point where I can dimension a part using the workplanes in that part. Now I'm trying to get to the next step which is placing these same dimensions when this part is placed in an assembly. I think I'm almost there, but I can't get the last step, actually creating the dimension, to work. Could anyone help me out on this one?
Here's my code:
Dim oDoc As DrawingDocument oDoc = ThisApplication.ActiveDocument Dim oSheet As Sheet oSheet = oDoc.ActiveSheet Dim oDrawingViews As DrawingViews Dim oDrawingView As DrawingView oDrawingView = ActiveSheet.View("VIEW1").View Dim oModelAsm As AssemblyDocument oModelAsm = oDrawingView.ReferencedDocumentDescriptor.ReferencedDocument Dim oModelAsmCompDef As AssemblyComponentDefinition oModelAsmCompDef = oModelAsm.ComponentDefinition Dim oModelPart As ComponentOccurrence oModelPart = oModelAsmCompDef.Occurrences.ItemByName("Profiel") Dim oModelPartDoc As PartDocument oModelPartDoc = oModelPart.Definition.Document Dim oModelPartCompDef As PartComponentDefinition oModelPartCompDef = oModelPartDoc.ComponentDefinition Dim oOnderkant As WorkPlane oOnderkant = oModelPartCompDef.WorkPlanes.Item("WPL_Onderkant") Dim oBovenkant As WorkPlane oBovenkant = oModelPartCompDef.WorkPlanes.Item("WPL_Bovenkant") Dim oOnderkantIntent As GeometryIntent oOnderkantIntent = oSheet.CreateGeometryIntent(oOnderkant) Dim oBovenkantIntent As GeometryIntent oBovenkantIntent = oSheet.CreateGeometryIntent(oBovenkant) Dim oGeneralDims = oSheet.DrawingDimensions.GeneralDimensions Dim oPointX As Double oPointX = -2 Dim oPointY As Double oPointY = 0 Dim oPoint As Point2d oPoint = ThisServer.TransientGeometry.CreatePoint2d(oPointX, oPointY) MsgBox("This is where I stop working.") Dim oLinearDimLengte = oGeneralDims.AddLinear(oPoint, oOnderkantIntent, oBovenkantIntent)
Solved! Go to Solution.