Blocklist OnDragnDropToAutoCAD

Started by AutoKAD, June 03, 2011, 07:16:34 PM

Previous topic - Next topic

AutoKAD

Why is it when using either the blockview or blocklist control event DragnDropToAutoCAD the block is not inserted.  If I uncheck the event in OpenDCL Studio, the block inserts just fine.  Anyone know what is going on here?  I did a search and found something similar http://www.opendcl.com/forum/index.php?topic=774.0 .

Thanks,

Kevin

owenwengerd

If the events are enabled, then the lisp event handler overrides the default handler. In the future, there could be a return value from the lisp event handler that signals whether or not to run the default handler, but for now, your handler must implement everything itself.

AutoKAD

Thanks for the explanation Owen.

Now, for my next question.  I've tried to use dcl_InsertBlock with the blocklist control event DragnDropToAutoCAD to insert the selected block, but it does not insert the block.  When I get a minute, I'll post a sample.  I'm probably doing something wrong and don't realize it.

-Kevin

AutoKAD


owenwengerd

(dcl_InsertBlock) only inserts the model space of the drawing file you specify, so it will not work in your case. To insert a specific block, you'll need to roll your own. You may need to change the BlockList control's Event Invoke property to Asynchronous.

AutoKAD

Ahhhh...ok.  After reading the help file again, I see what I was missing.  The BlockName is just to issue a new name for the model space being inserted.  I was thinking it was pulling the block for the BlockName from the DwgFilePath.

I got something that works for me for now.  I put a request in the Wish List for what you mentioned:

Quotea return value from the lisp event handler that signals whether or not to run the default handler

What I was trying to accomplish was to have a textbox control on my form that would specify a uniform block scale and use that value to scale the block after it was dragged into the drawing using:

Code (autolisp) Select

(setq obj (vlax-ename->vla-object (entlast)))
(vlax-invoke-method obj 'ScaleEntity scale rot)


For now, I've set up a button to scale the block after dragging it into the drawing using the method above.  If anyone has a better suggestion, I'm all ears.  As long as it doesn't involve WBlocking out all my blocks into a folder or set of folders.  I like the way the blocklist control allows you to keep your blocks in one DWG file or grouped into a set of files (People_2D.dwg, Cars_Plan.dwg, etc.).  Then all you have to do is add one folder to your support file search path and make a Combo Box as a filter for the DWG files in that folder.  Anyway, just my preference.

-Kevin

owenwengerd

You could possibly get what you're after by setting up a one-shot ObjectAppended database reactor that triggers the scaling (the actual scaling would have to be done in an external function triggered via dcl_SendString, because you can't modify the object while it is notifying).

jbuzbee

If you want to use an external drawing file to "import" blocks you'll need to roll your own "import" sub using ObjectDBX.  There are many good examples and code over at theSwamp.org.

AutoKAD

Thanks for the suggestions.  I'm looking into ObjectDBX now.  Checking out some examples from theSwamp.org.  Though, I want to write my own, so I know what is going on.  Time to put on my helmet, I feel a crash coming on.