I logic Part & Drawing Rules

I logic Part & Drawing Rules

SDHarn
Participant Participant
367 Views
1 Reply
Message 1 of 2

I logic Part & Drawing Rules

SDHarn
Participant
Participant

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)

0 Likes
368 Views
1 Reply
Reply (1)
Message 2 of 2

Xun.Zhang
Alumni
Alumni

Hello,

If you are talking about drawing annotation, then, it sounds like you have to predefine lots of annotation rules but it seems not that easy because of annotation complexity. For example, you may create angle for two line or the distance for two lines as well and the view's line is not easy to pick with the rule.

Part dimension and drawing annotation (dimension) are quiet different, assume it might not true for such topic to add dimension automatically.

Hi @JaneFan, could you help sheded more lights here?

Thank you!


Xun
0 Likes