Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

iLogic to automate "re-apply model properties" to a model sketch within a drawing view

brendan6HKZU
Explorer

iLogic to automate "re-apply model properties" to a model sketch within a drawing view

brendan6HKZU
Explorer
Explorer

Looking for an iLogic code to automate "re-apply model properties" function within inventor drawing view anytime the model/view is updated. Currently I have a model sketch that I show in my view on the drawing. The sketch has an array of lines that has a specific color assigned to it. When the array adds lines, then snew lines come in without the assigned color in the sketch. I then click "re-apply model properties" after the update the model/view, and this then fixes the new lines to have the correct color. I want to automate this so I don't have to click this button anytime the model/view changes. See attached pic of where this button is in the model browser. Should be an easy solution, I just don't know how to code this button.

 

brendan6HKZU_0-1726855956974.png

 

 

 

0 Likes
Reply
209 Views
4 Replies
Replies (4)

J_Pfeifer_
Advocate
Advocate

People have dome some similar things to this. It seems you're working from assemblies so this should be pretty relevant: 

 

https://forums.autodesk.com/t5/inventor-programming-ilogic/ilogic-get-model-sketches-to-drawing-view...

 

There is no call to just get to that option as a true or false. You have to chase it through the drawing view using the referenced document descriptor. Then filter it out any other items, you have yours named so I imagine this will work very closely to what you're looking for. 

 

What a weird option in the model browser, it even has a hotkey in the drawing view. Good information to know though, it just indirectly solved one of my drawing problems.

0 Likes

CGBenner
Community Manager
Community Manager

@brendan6HKZU Did the information provided answer your question? If so, please use Accept Solution so that others may find this in the future. Thank you very much!


Chris Benner
Industry Community Manager – Design & Manufacturing


If a response answers your question, please use  ACCEPT SOLUTION  to assist other users later.


Also be generous with Likes!  Thank you and enjoy!


Become an Autodesk Fusion Insider
Inventor/Beta Feedback Project
0 Likes

brendan6HKZU
Explorer
Explorer

I took the rule from the posted article above. I modified line 4 to match my drawing view number (35) and modified the sketch name on line 17 to match my sketch that is in the drawing. I then get the error message that is posted in the picture below. Please advise on how I can fix this if possible. I think this could work but there is a chance I am not properly applying the code. Thanks

 

brendan6HKZU_0-1727350918874.png

 

brendan6HKZU_1-1727351005970.png

 

Paul1084
Advocate
Advocate

Hi, you need to create a geometry proxy for the sketch first:

 

 

if oSketch.Name = "Wire/Swage Sketch" Then
Call
occ.CreateGeometryProxy(oPartDef.Sketches.Item(oSketch.Name), oSketchProxy)
oView.setIncludeStatus(oSketchProxy, True)
oView.setVisablity(oSketchProxy, True)
End If

 

Note, this wont re-apply model properties though. once the sketch has already been set to be included, if the sketch properties are then updated eg. line colour, the sketch does not update, even if you run this rule again... to update, perhaps set include status to false, update, then set to true again forcing the IDW to get the sketch again with the updated properties.

0 Likes