Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iLogic not updating when using save rule

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
sbell7ENRD
428 Views, 5 Replies

iLogic not updating when using save rule

I am using the below rules to force iproperties to be populated when the dwg file is saved.

The input boxes are coming up when saving the document, but the details entered are not updating in iproperties. 

 

Dim doc = ThisDoc.Document

Dim oCreationTime As String = doc.PropertySets.Item("Design Tracking Properties").Item("Creation Time").Value 

If oProject = "" Then myparam = InputBox("Input Project No.", "Project No.", "-")
If oDesigner = "" Then myparam = InputBox("Input Designer Name", "Designer", "-")
If oDescription = "" Then myparam = InputBox("Input Description.", "Description.", "-")
If oPartNumber = "" Then myparam = InputBox("Input Drawing Number.", "Drawing Number.", "-")
If oDiscipline = "" Then d1 = InputListBox("Prompt", MultiValue.List("d1"), d1, Title := "Discipline", ListName := "Type")
If oSecurityClass = "" Then d0 = InputListBox("Prompt", MultiValue.List("d0"), d0, Title := "Input Security Class", ListName := "Security Class")

If oCreationTime < "01/01/2020" Then MessageBox.Show("Creation Time is empty", "Ilogic")

InventorVb.DocumentUpdate()
iLogicVb.UpdateWhenDone = True

 

5 REPLIES 5
Message 2 of 6
A.Acheson
in reply to: sbell7ENRD

With the rule you have posted there is no iproperties assigned to the variables you are checking. Here is an example .

Firstly assign the ilogic snippet for iproperty to the variable. Then check if it is blank, if found blank the input box allows the user to input the value then the iproperty is set to the variable value. 

 


oDescription =
iProperties.Value("Project", "Description")

If oDescription = "" Then

oDescription = InputBox("Input Description.", "Description.", "-")
iProperties.Value("Project", "Description") = oDescription

End If

 

Using the API property sets method this is what the description code looks like. The iLogic snippet shown above uses this behind the scenes.

Dim oDescription As String = doc.PropertySets.Item("Design Tracking Properties").Item("Description").Value

 


 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
Message 3 of 6
Michael.Navara
in reply to: sbell7ENRD

I don't know what the variables oProject and myparam are. But try the following code update

If oProject = "" Then myparam = InputBox("Input Project No.", "Project No.", "-")

change to

If oProject = "" Then oProject = InputBox("Input Project No.", "Project No.", "-")

and so on...

 

 

Message 4 of 6
J-Camper
in reply to: sbell7ENRD

@A.Acheson  , touched on how you would actually update the iProperties in the drawing file, but I have another question.  I would also ask where this rule lives. 

 

I would think, by the wording of your question, the rule would live in the drawing, but drawing parameters are not unique [make 2 sketches in a drawing and each will start with "d0" as the first dimension], so the use of multivalue list parameters d1 & d0 in the rule would make me think the rule lives in the part file [only if those inputlist boxes get displayed correctly, which I think you are confirming?]

 

Can you provide more information as to where the rule lives, what needs to be updated, and where you are looking for the information?

Message 5 of 6
sbell7ENRD
in reply to: A.Acheson

Thank you for the quick reply.
This solution works for Standard iProperties, but not Custom iProperties, any idea what I would need to do differently in order to get the rule to work for both?
Message 6 of 6
A.Acheson
in reply to: sbell7ENRD

The best place to find this info is in the list of snippet categories on the left of the rule editor. You will find the tab iProperties, and find custom. When you right click the iProperty menu of any part/asssembly/drawing the tab headers is the first string value of the snippet And the name of the iProperty is the next. 

iProperties.Value("Custom", "Entername")

 

iProperties.Value("Summary", "Category")

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan

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

Post to forums  

Autodesk Design & Make Report