What's new

Determine Sketch Being Edited

sbrown

New Member
I would like to be able to programmatically determine if a 2D sketch is currently in edit mode and if so, which sketch it is.

I've tested the IsActive property of the IADSketch interface and determined that this only tells me whether the sketch is visible or not and is unrelated to editing. Multiple sketches can simultaneously return true for the IsActive property.

My use case for this would be an addon that modifies a sketch that is currently being edited by the user. For example, adding geometry for a specific type of profile such as an involute gear. I suppose I could always create a new sketch as opposed to trying to edit an existing, but this may not be quite a useful and it could cause an error if I try to edit a new sketch while another one is currently being edited (based on IADSketch.BeginSketch() documentation). It would at least be nice to know if sketch edit mode is active so that this error could be avoided.

Another observation that I have made that I think will be problematic is that while editing a new sketch in the UI, that sketch is not included in the Sketches property of the current IADPartSession.

If anyone has encountered these challenges before, please let me know if you have any suggestions.

Thanks!
 

sbrown

New Member
Update: I determined that a new sketch can be created and edited while another sketch is in edit mode via the user interface without causing any problems. At this point I assume the limitation only applies to sketches being edited programmatically although I haven't tested this year.
 
Top