I can't work this out.
According to the ADN the only way to insert a block and at the same time update constrained dimensions is to regen:
Application.DocumentManager.MdiActiveDocument.SendStringToExecute("DIMREGEN ", True, False, False)
Application.DocumentManager.MdiActiveDocument.SendStringToExecute("REGEN ", True, False, False)
After which I try to retain the selected the block
psr = ed.SelectLast
ed.SetImpliedSelection(psr.Value)
Is there a way I can force the command(stack) to operate consecutively? For some reason the block selection isn't retained.
Solved! Go to Solution.
Solved by Alfred.NESWADBA. Go to Solution.
Hi,
don't use SendCommand if you can avoid it. And to do REGEN you can:
Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor.Regen
- alfred -
Hi,
It seems that the advice the ADN gave is currently the only way unfortunately.
I've now thought to restricted the regen SendCommands to only be used when to inserting a dimensioned block.
It will now be unnoticeable.
But I can replace the other SendCommand regens I use with the one you suggested which helps.
Thanks again!
Hi,
in the case I need a sendcommand ... and I know it's executed when my current command ended I do the following:
The following is no code, just the structure!
private psr() as ObjectID 'dim the variable Public sub myMainCommand psr = ed.SelectLast 'save your selectionset 'BTW I don't know what "SelectLast" in your code is ... do anything call sendCommand("DIMREGEN" & vbnewline) ... do anything call sendCommand("DIMREGEN" & vbnewline) 'now the steps you need to get this workaround working AddHandler for CommandEnded call sendCommand("myDummyEndCommand") End sub Public sub myDummyEndCommand ...this is just to be defined End sub EventHandler for CommandEnded: if CommandName = "myDummyEndCommand" then RemoveHandler for CommandEnded ...do the jobs like ed.SetImpliedSelection(psr.Value) end if
So simplified described:
in your maincommand you place commands onto the comamnd-stack
when your main-command is finished the command-stack sends command by command (so your DIMREGENs or whatever else
and within your mainsub we have defined to run "myDummyEndCommand" as last command
and we have defined an eventhandler watching every single CommendEnded event
so if this handler now catches the command "myDummyEndCommand" the eventhandler knows that way your last command in the main-workflow and can now create a PickfirstSelectionSet/ImpliedSelection.
HTH, - alfred -
Can't find what you're looking for? Ask the community or share your knowledge.