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 parameter help

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
dclunie
1543 Views, 3 Replies

ilogic parameter help

Hi

 

I am after help to change some code that was supplied by Curtis Waguespack that adds description to all parts with a certain type of material,(ie finds all material that is plywood and adds a description formula to the parts within an assembly)

 

what i am after is a input box to change all part thicknesses of all parts that are found to new user value

 

User value that we use to hold thickness values in all .ipts is G_T

 

  1. find all .ipts within an assembly
  2. input to ask user thickness
  3. change all .ipt parameters ("G_L") that control thickness to newly inputted value

 

 

below is code used to alter descriptions on all .ipts found with material = to (plywood)

 

''kUnknownDocumentObject = 12289

'kPartDocumentObject = 12290

'kAssemblyDocumentObject = 12291

'kDrawingDocumentObject = 12292

'kPresentationDocumentObject = 12293

'kDesignElementDocumentObject = 12294

'kForeignModelDocumentObject = 12295

'kSATFileDocumentObject = 12296

'kNoDocument = 12297

 

Dim openDoc As Document

openDoc = ThisDoc.Document

Dim mywidth As Integer

Dim docFile As Document

 

If openDoc.DocumentType = 12291 Then

 

      For Each docFile In openDoc.AllReferencedDocuments

     

            If docFile.DocumentType = 12290 Then

                       

            Dim FNamePos As Long

                  FNamePos = InStrRev(docFile.FullFileName, "\", -1)   

                                            

                  Dim docFName As String

           

                  docFName = Right(docFile.FullFileName, Len(docFile.FullFileName) - FNamePos)                    

 

                  'select for part files with specified material

                  If iProperties.Material(docFName) = "PLYWOOD"  Then

                  'set description

                  iProperties.Value(docFName, "Project", "Description")= "=<Material> <G_L>"

                  iProperties.Value(docFName, "Project", "Part Number")  = Left(docFName, InStrRev(docFName, ".") - 1)

           

                 

                  End If

           

            End If

           

      Next

     

      Else

     

      MessageBox.Show("You must have a valid Assembly document open before using this code!", "File Type Mismatch!")

     

 

     

     

End If

 

 

3 REPLIES 3
Message 2 of 4
Curtis_Waguespack
in reply to: dclunie

Hi dclunie, 

 

Here is some code that will set the Thickness parameter (if it is present) in each part file. You can use it as an example to modify your code.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com


 

Dim openDoc As Document
openDoc = ThisDoc.Document
Dim docFile As Document

'get input from user
myThickness = InputBox("Enter Thickness", "iLogic", "0.75")

'look at all of the parts in the assembly
For Each docFile In openDoc.AllReferencedDocuments
If docFile.DocumentType = 12290 Then
'get the part file names
Dim FNamePos As Long
FNamePos = InStrRev(docFile.FullFileName, "\", -1)   
Dim docFName As String
docFName = Right(docFile.FullFileName, Len(docFile.FullFileName) - FNamePos)                    
'select for part files with specified material
if iProperties.Material(docFName) = "PLYWOOD"  Then
'set description
iProperties.Value(docFName, "Project", "Description")= "=<Material> <G_L>"
iProperties.Value(docFName, "Project", "Part Number")  = Left(docFName, InStrRev(docFName, ".") - 1)
'ignore error if parameter is not in the part
Parameter.Quiet=True
'set parameter value
Parameter(docFName, "Thickness") = myThickness
End If
End If
Next

iLogicVb.UpdateWhenDone = True

 

Message 3 of 4
dclunie
in reply to: Curtis_Waguespack

HI Curtis

 

Excellent piece of work you just saved me hours of manual work

Many Thanks

 

Dave

Message 4 of 4
Rich.O.3d
in reply to: dclunie

I was under the impression that cc / ifeatures used, for eg:

 

100x10 Flat Bar x 500 Lg

 

would have:

G_W = 100

G_H = 10

G_L = 500

 

I was planning on using these parram names for ease of coord with existing Inventor Nomenclature

 

If im mistaken could you enlighten me a bit further on what parts of inventor use what parrams

Cheers

 

 

 

CAD Management 101:
You can do it your own way,
If its done just how I say!
[Metallica:And Justice For All:1988]

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

Post to forums  

Autodesk Design & Make Report