Inventor General

Reply
Valued Contributor
LSA-skan
Posts: 95
Registered: ‎08-09-2012
Message 1 of 4 (326 Views)

My iTrigger is not working.!?, and i need to remove the dialog boxes.!

326 Views, 3 Replies
08-12-2012 11:24 PM

Hi.... 2 things..!

 

1. I have been trying to get iTrigger working, but so far without luck.

 

I have tried..:

 

trigger = iTrigger0

and

i = iTrigger0 (i saw this in another rule somewhere.)

 

both in the beginng of my rule, but doesn't seem to make any diffrence.

 

im not sure if theres something in the rule that is preventing the trigger from working, it´s copy-pasted from this forum.!

 

2. Also, i would like to set a trigger event for this rule, but would like to have all the dialog boxes removed, when the rule is activated. I want the choises to be preset in the rule.! it should just be like a background process when the event triggers :smileyhappy:

 

 

Heres the rule i want to trigger..: so 1. iTrigger is not working and 2. remove dialog boxes when the rule is activated 

trigger = iTrigger0
question = MessageBox.Show("Are you sure you want to change the units of measure?", _
"iLogic",MessageBoxButtons.YesNo)

If question = vbNo Then
Return
Else

'get input from user
oUnit = InputRadioBox("Select a units of measure type", "Metric", "Imperial", True, "ilogic")

'create precision value list
oPrecisionArray = New String(){0, 1, 2, 3, 4, 5}

'get input from user
oPrecision = InputListBox("Select the number of decimal places to use for the units of length display.", _
oPrecisionArray, 1, "iLogic", "Decimal Places ")

'example UnitsTypeEnum Enumerators
'kCentimeterLengthUnits = 11268
'kMillimeterLengthUnits = 11269
'kInchLengthUnits = 11272

'kKilogramMassUnits = 11283
'kGramMassUnits = 11284
'kLbMassMassUnits = 11286

If oUnit = True Then
'set to millimeter
oUOM_1 = 11269
'set to kilogram
oUOM_2 = 11283
Else
'set to inch
oUOM_1 = 11272
'set to pounds mass
oUOM_2 = 11286
End If

'Define the open document
Dim openDoc As Document
openDoc = ThisDoc.Document
'set length units for the top level assembly
openDoc.unitsofmeasure.LengthUnits = oUOM_1
'set mass units for the top level assembly
openDoc.unitsofmeasure.MassUnits = oUOM_2
'set precision
openDoc.unitsofmeasure.LengthDisplayPrecision = oPrecision

'Look at all of the files referenced in the open document
Dim docFile As Document
For Each docFile In openDoc.AllReferencedDocuments
'format file name
Dim FNamePos As Long
FNamePos = InStrRev(docFile.FullFileName, "\", -1)
Dim docFName As String
docFName = Right(docFile.FullFileName, Len(docFile.FullFileName) - FNamePos)
'set length units
docFile.unitsofmeasure.LengthUnits = oUOM_1
'set mass units
docFile.unitsofmeasure.MassUnits = oUOM_2
'set precision
docFile.unitsofmeasure.LengthDisplayPrecision = oPrecision
'rebuild to update the display
docFile.Rebuild
Next
End If
'update all
iLogicVb.UpdateWhenDone = True
*Expert Elite*
Curtis_Waguespack
Posts: 2,775
Registered: ‎03-08-2006
Message 2 of 4 (311 Views)

Re: My iTrigger is not working.!?, and i need to remove the dialog boxes.!

08-13-2012 06:46 AM in reply to: LSA-skan

Hi LSA-skan,

 

The trigger issue was the update when done line at the end:

 

'update all
iLogicVb.UpdateWhenDone = True

This prevented the trigger parameter from updating at the top of the rule as needed, and therefore the rule would not run. Changing the line to update InventorVb.DocumentUpdate() resolves this.

 

I've removed the input message boxes in the code as well.

 

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

 

 

 

trigger = iTrigger0
       
'set to millimeter
oUOM_1 = 11269
'set to kilogram
oUOM_2 = 11283

'Define the open document
Dim openDoc As Document
openDoc = ThisDoc.Document
'set length units for the top level assembly
openDoc.unitsofmeasure.LengthUnits = oUOM_1
'set mass units for the top level assembly
openDoc.unitsofmeasure.MassUnits = oUOM_2
'set precision
openDoc.unitsofmeasure.LengthDisplayPrecision = oPrecision
               
'Look at all of the files referenced in the open document
Dim docFile As Document
For Each docFile In openDoc.AllReferencedDocuments                
'format  file name                   
Dim FNamePos As Long
FNamePos = InStrRev(docFile.FullFileName, "\", -1)                        
Dim docFName As String
docFName = Right(docFile.FullFileName, Len(docFile.FullFileName) - FNamePos)      
'set length units
docFile.unitsofmeasure.LengthUnits = oUOM_1
'set mass units
docFile.unitsofmeasure.MassUnits = oUOM_2
'set precision
docFile.unitsofmeasure.LengthDisplayPrecision = 3
'rebuild to update the display
docFile.Rebuild
Next    

'update all
InventorVb.DocumentUpdate()


 



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





Valued Contributor
LSA-skan
Posts: 95
Registered: ‎08-09-2012
Message 3 of 4 (288 Views)

Re: My iTrigger is not working.!?, and i need to remove the dialog boxes.!

08-13-2012 11:08 PM in reply to: Curtis_Waguespack

Hi Curtis

 

The boxes are now removed..! Nice :smileyvery-happy: 1 kudos for that.!

 

However the iTrigger is still not doing anything. Is it becuase i have the rule in External, instead of In Document?

 

Which leads me to another thing.. i would like the rule and iTrigger to work for all my documents, both old and new ones...! is that possible?

 

/LSA-skan

Valued Contributor
LSA-skan
Posts: 95
Registered: ‎08-09-2012
Message 4 of 4 (246 Views)

Re: My iTrigger is not working.!?, and i need to remove the dialog boxes.!

10-24-2012 04:47 AM in reply to: Curtis_Waguespack

Hi Curtis

 

When i use the code you posted it always sets the Decimal to 1, even though it is set to 3??!what is wrong?

 

/LSA-Skan

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