05-02-2023
08:43 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
05-02-2023
08:43 AM
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.