Jump to content

Pull down menu question


Recommended Posts

Posted

Quick question. I am wondering if it is possible to have pulldown menus items be brought in on the layer that they were created on versus the layer that your template has current. I created pull down menus and (not thinking ahead) put them all on layer 0. They come in with all the attributes they were created with, but come in on the current layer. Can I change that?

Posted

While you may have created your blocks on layer "0" (good) they shouldn't be placed on layer "0" when inserted into a new drawing. Your blocks are behaving just the way they are supposed to.

Posted

ok, thank you much. I figured everything was working properly, I just was hoping to maybe "have it my way"

Posted

Your way meaning keeping your blocks on layer "0"? Usually not recommended. Remember that by creating the blocks on layer "0" when inserted on any other layer the blocks will take on the properties of that layer (color, linetype, etc.). That's what is normally considered the correct way of doing it.

 

If you want to run counter to that and force all blocks to be inserted on layer "0" then hard code it in your macro.

 

Caveat: After doing so you are not allowed to come back and complain about it. We have very good memories about these types of things.

Posted

Remark, it's sometimes not advantageous to have the internals of a block on layer 0. E.g. importing into Revit then places those lines on layer 0, no matter what layer the block / xref was inserted on. I'm not saying you shouldn't, its actually good practice - just that there is situations where this causes problems.

 

As for the op: uhm, pull down? Is this macros you added in cui? You'd be better off using tool palettes, otherwise you'll need some lisp to accomplish a place block X on layer Z in a macro. Actually I'd advise using a full on lisp defun with error check to revert back to the current layer if the user changes his mind and presses Esc. Otherwise it could leave the current layer on the intended insert layer.

Posted

I was speaking strictly from the standpoint of an AutoCAD user. I'm not aware of the pros and cons of creating/using blocks and layer "0" in such programs as Revit but thank you for bringing that to my attention.

Posted

^C^C-layer;m;m-duct;c;4;;;-insert;"DB90.dwg";\\;\

 

This creates the layer 'm-duct' sets colour to cyan (4) inserts the duct bend that was created on layer 0 and all done.

 

Result = cyan duct bend on layer m-duct.

 

It will prompt you for a scale. Just put the required duct size in provided the block is drawn to a size of 1. Duct bend diameter 1.

 

Block will need to be stored in an autocad support directory so it knows where to look. You can also add any directory support path to autocad. eg my documents/acadblocks.

Posted

The only issue I have with the strict macro method, is the current layer gets changed. And the user might get irritated by that. Here's a lisp to create the same:

(defun InsertBlock (BlkName LayerName / *error* oldLay)
 (setq oldLay (getvar 'CLayer))
 (defun *error* (msg)
   (if oldLayer (setvar 'CLayer oldLayer))
   (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
       (princ (strcat "\n** Error: " msg " **"))
   )
   (princ)
 )
 (if (tblsearch "LAYER" LayerName)
   (setvar 'CLayer LayerName)
   (command "._Layer" "_Make" LayerName "")
 )
 (command "._INSERT" BlkName)
 (while (> (getvar 'CmdActive) 0) (command pause))
 (*error* nil)
)

Then your macro to call such would be:

^C^C^P(InsertBlock "MyBlockName" "MyLayerName")

This would also create the layer if it doesn't exist, and set the layer current if it does. But even if the user presses Esc while the Insert command is still running the previous current layer will be set current again.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...