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 code to fix Base Qty

6 REPLIES 6
Reply
Message 1 of 7
Anonymous
1261 Views, 6 Replies

Ilogic code to fix Base Qty

Hi

 

I am after a code snippet that accesses the base qty field ,by default this is set to g_l length when we use frame generator to build stud walls we require this iproperties to be each and have the ability to run at assenbly level

 

Has anyone got any code i can cut and paste into my existing rules .

 

Any help would be appreciated

 

Dave

6 REPLIES 6
Message 2 of 7
MjDeck
in reply to: Anonymous

Dave,

 I'm not sure what you want to do.  Can you provide more details, and maybe post a sample assembly with the rules that you're using now?


Mike Deck
Software Developer
Autodesk, Inc.

Message 3 of 7
Curtis_Waguespack
in reply to: Anonymous

Hi dclunie, 

 

Here's a bit of code to toggle a part from G_L to Each. It may need to be incorporated into a larger rule to run it at the assembly level.

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

 

 

 

booleanParam = InputRadioBox("Select Base QTY type", "G_L", "Each", True, Title := "iLogic")

If booleanParam = True then
'set the Base Quantity to the parameter Length
p = Parameter.Param("G_L")
Call ThisDoc.Document.ComponentDefinition.BOMQuantity.SetBaseQuantity(BOMQuantityTypeEnum.kParameterBOMQuantity, p)
Else        
'set the Base Quantity to the parameter Each
Call ThisDoc.Document.ComponentDefinition.BOMQuantity.SetBaseQuantity(BOMQuantityTypeEnum.kEachBOMQuantity)
End if

iLogicVb.UpdateWhenDone = True

 

Message 4 of 7
Anonymous
in reply to: Curtis_Waguespack

Hi Curtis

 

you have sorted some code out for me before in relation to frame generator  to fix description and file name could this solution be added to snippet of code that you gave me before. a screen shot attached to area that i am trying to change

during the ilogic run on save event.

 

  • Area trying to cange is BaseQTY to each as after insert frome frame generator part as default is looking at b_l value by default.

Code snippet is below that you provided me with before

 

 

 

 Base Qty To each.JPG

 

 

 

''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 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) = "TIMBER" Then 'set description iProperties.Value(docFName, "Project", "Description")= "=<G_L> X <G_W> X <G_T>" 'set part number to file name 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

 

 

 

Regards

 

D Clunie

 

Message 5 of 7
Anonymous
in reply to: MjDeck

hi

 

I have just responded to Curtis Waquespack as he has posted a solution but any extra help would be appreciated

 

Regards

 

D Clunie

Message 6 of 7
Curtis_Waguespack
in reply to: Anonymous

Hi dclunie,

 

I gave this a quick try and wasn't sucessful. Hopefully Mike will jump in and offer something. If not I'll try and have another look later.

 

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

 

 

Message 7 of 7

Hi @Curtis_Waguespack 

 

I've done a bit of googling and found this post, and tried your snippet of iLogic code below & it worked well. I'm just wondering if it could be tweaked slightly. Is there a way to remove the prompt box that asks you for base quantity type and only trigger the rule if there is a parameter renamed to G_L as you had below? (in my case it would be named length).

 

Reason being I would like to put it in our part template but if the other draftsman don't want to use it, it wont hinder them or pop up and 'annoy' them. So if there is no parameter named G_L the rule would not run, and base quantity would stay at each.

 

Thanks,

 

Joe

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

Post to forums  

Autodesk Design & Make Report