Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iLogic to create parameter in all parts within a drawing

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
532 Views, 3 Replies

iLogic to create parameter in all parts within a drawing

Anonymous
Not applicable

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

 

 

 

 

 

0 Likes

iLogic to create parameter in all parts within a drawing

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

 

 

 

 

 

Tags (2)
3 REPLIES 3
Message 3 of 4
Anonymous
in reply to: Curtis_Waguespack

Anonymous
Not applicable

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

0 Likes

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

Message 4 of 4
Curtis_Waguespack
in reply to: Anonymous

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

Post to forums  

Autodesk Design & Make Report