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: 

To build up rule commomn for Part, Assembly and Drawing Documents

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
RoyWickrama_RWEI
406 Views, 3 Replies

To build up rule commomn for Part, Assembly and Drawing Documents

I need to run some of my rules in part, assembly and drawing documents. But I could never do it despite I spend a lot of time. It runs for drawings only and gives error shown below for other documents.

Capture July1st.PNG

Post_July1st.png

Sample rule is attached.

3 REPLIES 3
Message 2 of 4

Change

 

ThisDrawing to ThisDoc

Please use the ACCEPT AS SOLUTION or KUDOS button if my Idea helped you to solve the problem.

Autodesk Inventor Professional Certified 2014
Message 3 of 4

@RoyWickrama_RWEI,

 

Try below iLogic code.

 

Sub Main()
	oRuleNo = "RULE NO: iL0071"
	'Dim oDoc As DrawingDocument
	'oDoc = ThisApplication.ActiveDocument
	oDoc = ThisApplication.ActiveDocument
	'check file type
		 
	If oDoc.DocumentType = DocumentTypeEnum.kDrawingDocumentObject Then
		MessageBox.Show("Drawing document!", oRuleNo)
		oProcess_Dwg()
	End If


	If oDoc.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
		MessageBox.Show("ASSEMBLY Document!", oRuleNo)
		oProcess_Assy()
	End If

	If oDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject Then
		MessageBox.Show("PART Document!", oRuleNo)
		oProcess_Part()
	End If 
	 
End Sub

Sub oProcess_Dwg()
	oModelDoc = IO.Path.GetFileName(ThisDrawing.ModelDocument.FullFileName) 
End Sub

Sub oProcess_Assy()

End Sub

Sub oProcess_Part()


End Sub

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



Message 4 of 4

Thanks a lot. It is doing well.

I appreciate your hep.


@dgreatice wrote:

Change

 

ThisDrawing to ThisDoc



lp.

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

Post to forums  

Autodesk Design & Make Report