Author Topic: Tool palettes, oh why do you tease me so..  (Read 3976 times)

0 Members and 1 Guest are viewing this topic.

BAshworth

  • Guest
Tool palettes, oh why do you tease me so..
« on: June 13, 2007, 08:07:54 PM »
Sorry its been so long.  I need days to be longer than 24 hours here lately.

I need someone good with tool palettes in ADT.

Specifically, I'm looking to insert a block reference from a tool palette utilizing a specific layerkey override.

Being that a block is an AutoCAD object, and not an AEC object, there is no method for setting the layerkey the block is supposed to use when inserted.

What I have been able to do, is to make a multi-view block of my block, and make a tool for inserting that block on a specific layerkey.  Which works beautifully, except that multi-view blocks are a pain in the arse to work with in the drawing.

Any clues on if I'm just missing something, or is there maybe some obscure, and undocumented (not that rare an occurance I've discovered) AEC command for inserting a block that I can use?

If there was a method for using a lisp routine for inserting a block reference from another drawing (instead of inserting a drawing as a block itself)  that would work wonders as well.

BAshworth

  • Guest
Re: Tool palettes, oh why do you tease me so..
« Reply #1 on: June 14, 2007, 05:43:12 PM »
Dang, stumped the swamp too.

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: Tool palettes, oh why do you tease me so..
« Reply #2 on: June 18, 2007, 10:29:02 AM »
I gave up on Tool Palettes a loooong time ago.

Quote
If there was a method for using a lisp routine for inserting a block reference from another drawing (instead of inserting a drawing as a block itself)  that would work wonders as well.

Yes, there is.  Take a look at the following:

Code: [Select]
(defun jb:InsertSymbol(lkey dname / *Error*)
  (defun *Error*  (Msg)
    (cond ((or (not Msg)
       (member Msg '("console break"
     "Function cancelled"
     "quit / exit abort"))))
  ((princ (strcat "\nError: " Msg))))
    (jb:ResetActiveSymbolLayer)
    (princ))
  (cond((= lkey "Appliances")
   (jb:SetActiveSymbolLayer "APPL"))
  ((= lkey "Furniture")
   (jb:SetActiveSymbolLayer "FURN"))
  ((= lkey "Lighting")
   (jb:SetActiveSymbolLayer "LIGHTCLG"))
  ((= lkey "Power")
   (jb:SetActiveSymbolLayer "POWER"))
  ((= lkey "HVAC")
   (jb:SetActiveSymbolLayer "EQUIPCLG"))
  ((= lkey "Plumbing")
   (jb:SetActiveSymbolLayer "PFIXT"))
       ((= lkey "Fire")
   (jb:SetActiveSymbolLayer "FIRE"))
       ((= lkey "Equipment")
   (jb:SetActiveSymbolLayer "EQUIP"))
       (t (jb:SetActiveSymbolLayer "EQUIP"))
       )
 
        (if (not (tblsearch "block" dname))
          (jb:ImportBlock (jb:ReturnProjectAECStylesStandardsFile) dname))
  (command "_.insert" dname "_scale" 1 pause "0")
  (jb:ResetActiveSymbolLayer)
  (princ)
  )

I use this to insert dynamic symbol blocks, i.e. electrical, appliances, tags, etc.  Here is a breakdown of whats going on:

(jb:SetActiveSymbolLayer "APPL") saves the current layer name, creates and sets current the layer associated with the layerkey "APPL".
(jb:ImportBlock (jb:ReturnProjectAECStylesStandardsFile) dname) if the block doesn't exist in the current drawing, this imports it from the Project Standards file.
(jb:ResetActiveSymbolLayer) resets the current layer saved by jb:SetActiveSymbolLayer.

The layerkey sub routines utilize tools exposed by AecLMgrLisp.arx.  The import sub routine utilizes ObjectDBX.
James Buzbee
Windows 8

BAshworth

  • Guest
Re: Tool palettes, oh why do you tease me so..
« Reply #3 on: June 18, 2007, 12:50:09 PM »
Thanks, gives me something to chew on.  I think I can accomplish this with a call to a VBA routine.

Is there a benefit to using the layer key routines inside AecLMgrLisp.arx versus aecgeneratelayerkey?