Message 1 of 2
I logic Part & Drawing Rules
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
In my part file I have a form and rules that customize my part file, Then there is a button in my form that launches a template and places views on a new drawing. I would like to generate dimensions at the same time. The code i'm using uses work points, and it runs great as a drawing rule, how do I make it into a part rule that launches when the make drawing button is selected. Is it possible to generate dimensions in a drawing from the part file? below is the code I copied from the forum that I'm trying to include in my drawing generation rule.
SyntaxEditor Code Snippet
Dim oSheet As Sheet = ThisDoc.Document.ActiveSheet Dim oView As DrawingView = ActiveSheet.View("VIEW1").View Dim oDoc As Document = oView.ReferencedDocumentDescriptor.ReferencedDocument Dim oGeomIntent1 As Inventor.GeometryIntent Dim oGeomIntent2 As Inventor.GeometryIntent Dim oWP1 As Inventor.WorkPoint = oDoc.ComponentDefinition.WorkPoints.Item("Work Point7") Dim oWP2 As Inventor.WorkPoint = oDoc.ComponentDefinition.WorkPoints.Item("Work Point8") oView.SetIncludeStatus(oWP1, True) oView.SetIncludeStatus(oWP2, True) Dim oCenterMark1 As Inventor.Centermark Dim oCenterMark2 As Inventor.Centermark Dim oCenterMark As Inventor.Centermark For Each oCenterMark In oSheet.Centermarks If oCenterMark.Attached Then If oCenterMark.AttachedEntity Is oWP1 Then oCenterMark1 = oCenterMark End If If oCenterMark.AttachedEntity Is oWP2 Then oCenterMark2 = oCenterMark End If End If Next oGeomIntent1 = oSheet.CreateGeometryIntent(oCenterMark1, kPoint2dIntent) oGeomIntent2 = oSheet.CreateGeometryIntent(oCenterMark2, kPoint2dIntent) oCenterMark1.Visible = False oCenterMark2.Visible = False Dim textPoint As Inventor.Point2d = ThisServer.TransientGeometry.CreatePoint2d(17,10) Dim oDim as GeneralDimension = oSheet.DrawingDimensions.GeneralDimensions.AddLinear(textPoint, oGeomIntent1, oGeomIntent2, DimensionTypeEnum.kVerticalDimensionType)