Autodesk Inventor Customization
Reply
Topic Options
- Start Article
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Position of Part in idw
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
71 Views, 2 Replies
01-21-2013 05:50 PM
Hi,
How to get postion of faces of part when place on idw drawing file???
Do we need to use (ThisApplication.MeasureTools.GetMinimumDistance(o
If we use that we will get distance but how to get face postion on idw. do we need to use edges?? or lines???
Mechanical Engineer
Inventor Applications Engineer
--------------------------------------------------------------------------------------
If my solution seems to remedy your problem, please press the Accept Solution button, Some KUDOS -
-------------------------------------------------------------------------------------
Inventor Applications Engineer
--------------------------------------------------------------------------------------
If my solution seems to remedy your problem, please press the Accept Solution button, Some KUDOS -
-------------------------------------------------------------------------------------
Solved! Go to Solution.
Re: Position of Part in idw
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-24-2013 03:58 PM in reply to:
ADNpati
I found way again by myself.....
Using ModelToSheetSpace with drawingview we can get reference to anything from Model i.e., 3D Enviroment to sheet space Enviroment.
working on code and will post you in 10 mins... cheers
Mechanical Engineer
Inventor Applications Engineer
--------------------------------------------------------------------------------------
If my solution seems to remedy your problem, please press the Accept Solution button, Some KUDOS -
-------------------------------------------------------------------------------------
Inventor Applications Engineer
--------------------------------------------------------------------------------------
If my solution seems to remedy your problem, please press the Accept Solution button, Some KUDOS -
-------------------------------------------------------------------------------------
Re: Position of Part in idw
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-24-2013 04:38 PM in reply to:
ADNpati
Here is the complete code, hope this will be helpful for somebody
![]()
Option Explicit
Sub FaceRecognitiononIDW()
Dim oDrawingDoc As DrawingDocument
Set oDrawingDoc = ThisApplication.ActiveDocument
Dim oDef As ComponentDefinition
Dim itemCnt As Integer
itemCnt = 0
Dim oView As DrawingView
Set oView = oDrawingDoc.ActiveSheet.DrawingViews(1)
Dim oDoc As Document
Set oDoc = oView.ReferencedDocumentDescriptor.ReferencedDocum ent
Dim oPartDoc As Document
Dim oRrubberPart As PartDocument
Dim oAllRef As DocumentsEnumerator
Dim occ As ComponentOccurrence
Dim occDef As ComponentDefinition
Dim oTextBox As TextBox
Dim oPartCompDef As PartComponentDefinition
Dim oSurfBody As SurfaceBody
Dim oFa As face
' Set a reference to the active sheet.
Dim oActiveSheet As Sheet
Set oActiveSheet = oDrawingDoc.ActiveSheet
For Each occ In oDoc.ComponentDefinition.occurrences
If occ.DefinitionDocumentType = kPartDocumentObject Then
If occ.SurfaceBodies.count <> 0 Then
Set oPartDoc = occ.Definition.Document
Set occDef = oPartDoc.ComponentDefinition
Set oSurfBody = occDef.SurfaceBodies(1)
Set oPartCompDef = occ.Definition
For Each oFa In oSurfBody.Faces
itemCnt = itemCnt + 1
If oFa.SurfaceType = kPlaneSurface Then
' Getting a planar surface face above
' ground level and face not connected
' to any other face
If oFa.TangentiallyConnectedFaces.count = 0 Then
If oFa.PointOnFace.Z <> "0" Then
If ThisApplication.MeasureTools.GetAngle(oFa, occ.Definition.WorkPlanes(3)) = "0" Then
Dim oFaProxy As FaceProxy
Call occ.CreateGeometryProxy(oFa, oFaProxy)
' Get the point of the sketch
Dim oMidPoint As Point2d
Set oMidPoint = oView.ModelToSheetSpace(oFaProxy.PointOnFace)
' Set a reference to the TransientGeometry object.
Dim oTG As TransientGeometry
Set oTG = ThisApplication.TransientGeometry
Dim oLeaderPoints As ObjectCollection
Set oLeaderPoints = ThisApplication.TransientObjects.CreateObjectColle ction
' Create a few leader points.
Call oLeaderPoints.Add(oTG.CreatePoint2d(oMidPoint.x, oMidPoint.y))
Call oLeaderPoints.Add(oTG.CreatePoint2d(oMidPoint.x + 0.5, oMidPoint.y + 0.5))
' Create text with simple string as input. Since this doesn't use
' any text overrides, it will default to the active text style.
Dim sText As String
sText = "API Leader Note"
Dim oLeaderNote As LeaderNote
Set oLeaderNote = oActiveSheet.DrawingNotes.LeaderNotes.Add(oLeaderP oints, sText)
' Insert a node.
Dim oFirstNode As LeaderNode
Set oFirstNode = oLeaderNote.Leader.RootNode.ChildNodes.Item(1)
End If
End If
End If
End If
Next
End If
End If
Next
End Sub If found useful give some kudos
![]()
Mechanical Engineer
Inventor Applications Engineer
--------------------------------------------------------------------------------------
If my solution seems to remedy your problem, please press the Accept Solution button, Some KUDOS -
-------------------------------------------------------------------------------------
Inventor Applications Engineer
--------------------------------------------------------------------------------------
If my solution seems to remedy your problem, please press the Accept Solution button, Some KUDOS -
-------------------------------------------------------------------------------------

