- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi @anavazquez5LRNJ. I am a little confused about what your actual goal is in this post. I think you may need to include a lot more details and/or explain much more specifically what all you are trying to accomplish. Can you do what you want to do manually, but are trying to do it by code instead? If so, how do you currently do it manually? Are you trying to copy Parameter Type objects from a model document to a drawing document? Are you trying to create DrawingDimensions on a Sheet in a DrawingDocument?
What version of Inventor are you using? In some situations you can simply retrieve model dimensions directly into a drawing view using tools already available in Inventor's user interface, manually. When a drawing view contains an assembly, and you are trying to access things that are unique to just one component within that assembly, that can really complicate the efforts of doing things by code.
Wesley Crihfield
(Not an Autodesk Employee)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi @WCrihfield
Yes, I can get the dimensions of the assembly manually but I want to automate through ilogic, what I have now is that every time you click on an occurrence gives the name of it along with its parameters of width and length, what I want to achieve is that having those parameters to pass them to dimensions without using work plane or work point, but I do not know if it is possible.
I am using version 2024 of inventor.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
What will probably work best is to create dimensions using named edges or faces in the part. This would be much better than retrieving parameters from the occurence.
Here is a sample from the API help written in vba. Jelte has a great blog here on doing this using ilogic.
Or if this helped you, please, click (like)
Regards
Alan