I have iLogic code which when run from a drawing file recognises all parts referenced in a drawing and creates a custom iproperty within each part.
I want to change this slighty so instead of creating a custom iproperty it creates a parameter.
This is my code which currently creates a custom iproperty.
Dim openDoc As Inventor.Document
Dim docFile As Inventor.Document
Dim DrawingDoc As DrawingDocument
Dim FNamePos As Long
Dim docFName As String
Dim iDesc as String
DrawingDoc = openDoc
openDoc = ThisApplication.ActiveDocument
iDesc = iProperties.Value("Project", "Description")
For Each docFile In openDoc.AllReferencedDocuments
' Check if referenced document is a Part file. If it is, fill in the SK field.
If docFile.DocumentType = kPartDocumentObject Then
'If Not Mid(iDesc, Len(iDesc) - 4, 4) = "<SK>" Then
' iDesc = iDesc + "<SK>"
'End If
FNamePos = InStrRev(docFile.FullFileName, "\", - 1)
docFName = Mid(docFile.FullFileName, FNamePos + 1, Len(docFile.FullFileName) - FNamePos)
iProperties.Value(docFName, "Custom", "Rule1Status") = "RunRule1"
End If
Next
iLogicVb.UpdateWhenDone = True
Im not sure how to change this so a parameter is created instead of a custom iproperty
I have iLogic code which when run from a drawing file recognises all parts referenced in a drawing and creates a custom iproperty within each part.
I want to change this slighty so instead of creating a custom iproperty it creates a parameter.
This is my code which currently creates a custom iproperty.
Dim openDoc As Inventor.Document
Dim docFile As Inventor.Document
Dim DrawingDoc As DrawingDocument
Dim FNamePos As Long
Dim docFName As String
Dim iDesc as String
DrawingDoc = openDoc
openDoc = ThisApplication.ActiveDocument
iDesc = iProperties.Value("Project", "Description")
For Each docFile In openDoc.AllReferencedDocuments
' Check if referenced document is a Part file. If it is, fill in the SK field.
If docFile.DocumentType = kPartDocumentObject Then
'If Not Mid(iDesc, Len(iDesc) - 4, 4) = "<SK>" Then
' iDesc = iDesc + "<SK>"
'End If
FNamePos = InStrRev(docFile.FullFileName, "\", - 1)
docFName = Mid(docFile.FullFileName, FNamePos + 1, Len(docFile.FullFileName) - FNamePos)
iProperties.Value(docFName, "Custom", "Rule1Status") = "RunRule1"
End If
Next
iLogicVb.UpdateWhenDone = True
Im not sure how to change this so a parameter is created instead of a custom iproperty
Hi shmartin89,
There are some examples at these links:
http://www.mastergraphics.com/wordpress/2013/creating-a-parameter-with-ilogic/
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Hi shmartin89,
There are some examples at these links:
http://www.mastergraphics.com/wordpress/2013/creating-a-parameter-with-ilogic/
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
ThanksCurtis,
I will have a look at these links however this is just a round about way for me to try and run a rule which exists in all my parts.
Have you ever come accross a way of doing this from the drawing?
I.e - finding all referenced parts withing a drawing file and running a rule which exists in every part. (I have created a rule in my template part file - "Rule0")
Thanks,
Sandy
ThanksCurtis,
I will have a look at these links however this is just a round about way for me to try and run a rule which exists in all my parts.
Have you ever come accross a way of doing this from the drawing?
I.e - finding all referenced parts withing a drawing file and running a rule which exists in every part. (I have created a rule in my template part file - "Rule0")
Thanks,
Sandy
Hi shmartin89,
Have a look at this link:
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Hi shmartin89,
Have a look at this link:
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Can't find what you're looking for? Ask the community or share your knowledge.