iLogic MessageBox when edit sketch

iLogic MessageBox when edit sketch

Cosmin_V
Advocate Advocate
411 Views
3 Replies
Message 1 of 4

iLogic MessageBox when edit sketch

Cosmin_V
Advocate
Advocate

Hi everyone,
It is possible to open a message box when a certain sketch is in edit mode?

for ex.

I have a sketch (sketch8) and I will like if someone try to edit that sketch to get a message.

Like....

If Sketch8 = edit Then
	MessageBox.Show("Message", "Title")
End If 

 Many thanks!

0 Likes
412 Views
3 Replies
Replies (3)
Message 2 of 4

daniel.puchta
Enthusiast
Enthusiast

Hi, 

yes it is possible. Firstly create iLogic rule. Then set event trigger to run that rule - I recommend Any Model Parameter Change  event trigger. 

The rule is run when any model parameter is changed. If model parameter is changed and the Sketch8 is active, it will show the message. So if you for example change dimension in sketch8 when editing it you get the message.

If it will work for you please accept it as solution. 

 

 

Dim oSketch As PlanarSketch
If TypeOf ThisApplication.ActiveEditObject Is Sketch Then
	oSketch = ThisApplication.ActiveEditObject
	If ThisApplication.ActiveEditObject.Name = "Sketch8" Then
		MessageBox.Show("Warning Sketch6 is edited")
	End If
	
End If

 

 

0 Likes
Message 3 of 4

Cosmin_V
Advocate
Advocate

Thank you @daniel.puchta 


It works, but it is not very useful, because the parameters in the respective sketch do not change.
It is a sketch that, after being opened, the old drawing is erased and another is pasted.

0 Likes
Message 4 of 4

WCrihfield
Mentor
Mentor

It is likely still possible, but would probably require a lot more complication and work than it is worth to accomplish.  You would likely need to create your own custom event handler code to accomplish this.  And depending on your expectations of how/when it should work, you may need to create your own add-in to accomplish it.  I've created some custom event handlers before, but not one for this specific event.  I'm not even sure there is any event defined or exposed to the API for specifically just when you first enter into the Edit mode of a sketch.  I know there are ones for when you create a new sketch, when you delete one, and when a sketch 'changes' (complex meaning - when geometry actually changes as a result of the 'change').  These can be tricky to create and set up correctly, and you also have to have a plan for removing/destroying any custom event triggers you create, usually due to some other event happening.

Here is a link to one of my contribution posts that can get you started down that road, if you choose to do so.  It's not for that specific event, but there's a lot of good information there for dealing with other types of custom event handlers too.  The closest thing I can find to what you might need to work with is the SketchEvents object, and its 'OnSketchChange' event.  I dabbled with it a little bit, but don't have any complete working examples to post for you.

 

If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) 👍.

If you want and have time, I would appreciate your Vote(s) for My IDEAS 💡or you can Explore My CONTRIBUTIONS

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes