Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Numbering similar Occurrences in Drawing Sheet

1 REPLY 1
SOLVED
Reply
Message 1 of 2
ADNpati
458 Views, 1 Reply

Numbering similar Occurrences in Drawing Sheet

Hello All,

 

I am writhig a macro to put text ( count number) under each occurrence in an assembly.

I got the Sequence correct and able to place the cnumber un drawing sheet.

 

But What I need to do is to place that number under consequent occurrence.

Please find the Image file and you will see wht i am trying to get.

Any help will be highly appriciated.

 

i am icluding the Macro i written as well.

 

Private Sub RHSnumbering()
Dim oDrawingDoc As DrawingDocument
If ThisApplication.ActiveDocument.DocumentType <> kDrawingDocumentObject Then
Dim myVar1 As String
myVar1 = "Need to make a drawing the active document"
MsgBox Prompt:=myVar1, _
Title:="Drawing Document", _
Buttons:=vbExclamation

End
End If

Set oDrawingDoc = ThisApplication.ActiveDocument

Dim oView As DrawingView
If oDrawingDoc.ActiveSheet.DrawingViews.Count < 1 Then
Dim myVar2 As String
myVar2 = "Add a view to the drawing"
MsgBox Prompt:=myVar2, _
Title:="Views", _
Buttons:=vbExclamation

End
End If

Set oView = oDrawingDoc.ActiveSheet.DrawingViews(1)

Dim oDoc As Document
Set oDoc = oView.ReferencedDocumentDescriptor.ReferencedDocument

If oDoc.DocumentType <> kAssemblyDocumentObject Then
Dim myVar4 As String
myVar4 = "View's Referenced doc needs to be an assembly"
MsgBox Prompt:=myVar4, _
Title:="View Orientation", _
Buttons:=vbExclamation

End
End If


Dim oAssy As AssemblyDocument
Set oAssy = oView.ReferencedDocumentDescriptor.ReferencedDocument

Dim oSketch As DrawingSketch

Dim sText As Integer
Dim oTG As TransientGeometry
Dim oActiveSheet As Sheet
Set oActiveSheet = oDrawingDoc.ActiveSheet

Dim oGeneralNotes As GeneralNotes
Set oGeneralNotes = oActiveSheet.DrawingNotes.GeneralNotes
Dim oGeneralNote As GeneralNote

Dim Count As Integer
Dim oPoint As Point2d

Dim oOcc As ComponentOccurrence
Dim oOccDoc As Document
Dim oOccDocDef As AssemblyComponentDefinition
Count = 0
For Each oOcc In oAssy.ComponentDefinition.occurrences

If oOcc.DefinitionDocumentType = kAssemblyDocumentObject Then
If InStr(oOcc.Name, "RHS") Then

Count = Count + 1
Set oTG = ThisApplication.TransientGeometry
Set oOccDoc = oOcc.Definition.Document

Set oOccDocDef = oOcc.Definition


' //////////////////////////////////////////////////////////////////////////////////
Set oGeneralNote = oGeneralNotes.AddFitted(oTG.CreatePoint2d(3, 3), Count)
' In Above statement I am trying to give center point of each occurrencess
' and to place the text at that point with the count
' Got the counting sequence right but poisitiong..... I am out of ideas.

'//////////////////////////////////////////////////////////////////////////////////////



On Error Resume Next

End If

End If

Next

oDrawingDoc.Update
End Sub

 

Mechanical Engineer
Inventor Applications Engineer

--------------------------------------------------------------------------------------

If my solution seems to remedy your problem, please press the Accept Solution button, Some KUDOS -

-------------------------------------------------------------------------------------
1 REPLY 1
Message 2 of 2
ADNpati
in reply to: ADNpati

SOLVED IT.. AGAIN BY MYSELF...

Mechanical Engineer
Inventor Applications Engineer

--------------------------------------------------------------------------------------

If my solution seems to remedy your problem, please press the Accept Solution button, Some KUDOS -

-------------------------------------------------------------------------------------

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report