- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Very simplified, what i've got is the following:
A userform:
At one place in the form you can set the layer for lines.
At another place in the form you can set the layer for circles.
At another place in the form you can set the for blocks.
and so on....
Now, what I want is: (when a certain checkbox is checked so the userform should be active) the form detecting when the Autocad-user is clicking the 'line' button or the 'circle'-button from the standard Autocad Toolbars, or maybe types "insert" to insert a block, so the current layer can be set to wanted layer.
So I created a while loop which is active as long as the checkbox is checked. In this while-loop I get the last inserted command (by AutoCADAppServices.Application.GetSystemVariable("CMDNAMES"), convert it to a string, and do the 'switch' lines on the different cases (last command is _line then set layer to a, last command is _circle then set layer to b, last command is _insert then set layer to c).
2 questions:
1) is the 'switch'way the right way to do this?
2) (maybe not fully autocad-related): how can i prevent the code from getting stuck in the while-loop, so I cant click any commands anymore (nor uncheck the checkbox or do anything else).
Any help would be appreciated, I'm a little stuck on this the last days, can't get it to work nor I can check if at least i'm getting closer (because of while-loop getting stuck (which by the way makes perfect sense to me but I don't know how to prevent it)).
Thanks!
Solved! Go to Solution.