Inventor General Discussion

Reply
Valued Contributor
dclunie
Posts: 70
Registered: ‎03-26-2008
Message 1 of 4 (634 Views)
Accepted Solution

ilogic parameter help

634 Views, 3 Replies
06-06-2012 01:27 AM

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

 

 

*Expert Elite*
Curtis_Waguespack
Posts: 2,811
Registered: ‎03-08-2006
Message 2 of 4 (608 Views)

Re: ilogic parameter help

06-06-2012 07:57 AM 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

 



  solution.png  Did you find this reply helpful ? If so please use the Accept as Solution or  Kudos button below.





Valued Contributor
dclunie
Posts: 70
Registered: ‎03-26-2008
Message 3 of 4 (595 Views)

Re: ilogic parameter help

06-06-2012 10:14 PM in reply to: Curtis_Waguespack

HI Curtis

 

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

Many Thanks

 

Dave

Valued Mentor
Rich.O.3d
Posts: 523
Registered: ‎08-19-2008
Message 4 of 4 (588 Views)

Re: ilogic parameter help

06-06-2012 11:27 PM 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]

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community


Inventor Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Autodesk Inventor helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Inventor

Twitter

Facebook

Blogs

Pinterest

Youtube