Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
anavazquez5LRNJ
321 Views, 3 Replies

Place a dimension on a drawing

I don't know if it is possible to place a dimension on an assembly by clicking on an occurrence,
I don't know if it is possible to automate the measurements in the drawing without using Workplanes or Workpoint I just need to find a way to send the parameters (length and width) to text or to send them directly to the drawing.
This is the code I have been working with:

 

Dim oDrawcurveSeg As DrawingCurveSegment
oDrawcurveSeg = ThisApplication.CommandManager.Pick( Inventor.SelectionFilterEnum.kDrawingCurveSegmentFilter, "Select a drawingCurve")

  ' Get the parent DrawingCurve
    Dim oDrawCurve As DrawingCurve
    oDrawCurve = oDrawcurveSeg.Parent

    ' Get the model geometry this curve represents.

    Dim oModelGeom As Object
        oModelGeom = oDrawCurve.ModelGeometry

    ' Check to see if the returned object supports

    ' the ContainingOccurrence property.
    Dim oOccurrence As ComponentOccurrence
    oOccurrence = oModelGeom.ContainingOccurrence

    Dim oModelGeometry = oDrawcurveSeg.Parent.ModelGeometry

    Dim oCompDef As ComponentDefinition
    oCompDef = oModelGeometry.Parent.Componentdefinition

    partNameToTest = oCompDef.Document.DisplayName


	Dim parametroWidth As String = Parameter(partNameToTest, "Width")
	Dim parametroLength As String = Parameter( partNameToTest, "Length")
	
MessageBox.Show(partNameToTest & vbCrLf & "Width:" & parametroWidth & vbCrLf & "Length:" & parametroLength)

 

This is an example of what I'd like to get to, I've been looking for more but haven't found much.

anavazquez5LRNJ_0-1683042182523.png