Results 1 to 8 of 8

Thread: Newbie question/request....

  1. #1
    Member
    Join Date
    2007-01
    Posts
    10
    Login to Give a bone
    0

    Default Newbie question/request....

    Hi,
    I'm pretty new to customising and creating commands in autocad and was wondering if anyone could help me out. I'd like to create a new command (or just edit the standard button) for dimensions/leaders. I'd like the command to switch to a set layer before beginning the dimension/leader command. A few guys here (myself included when in a rush) tend to forget a bit of discipline with layers and end up with dimensions/leaders and text in all sorts of different layers by the end of the drawing! I know it's probably pretty simple but like I said I'm a complete novice at this kind of thing.

    If I've not explained that too well then apologies!

  2. #2
    I could stop if I wanted to
    Join Date
    2003-12
    Location
    Pittsburgh, PA
    Posts
    355
    Login to Give a bone
    0

    Default Re: Newbie question/request....

    Consider the use of Toolpalettes. You can drag a dimension to a toolpalette and set up the destination layer under the toolpalette's Properties

  3. #3
    I could stop if I wanted to
    Join Date
    2007-05
    Location
    Brookfield WI
    Posts
    331
    Login to Give a bone
    0

    Default Re: Newbie question/request....

    Quote Originally Posted by lpseifert View Post
    Consider the use of Toolpalettes. You can drag a dimension to a toolpalette and set up the destination layer under the toolpalette's Properties
    I was going to suggest going into the CUI and changing the dimension macro to not only repeat but to also set the layer. The tool palette suggestion is the simplest way to go. Search AutoCADs help on how to add commands the the palette, then right click the command and go into its properties. Once those are set up, export the palette to a network drive so everyone can use it.

    sample macro
    Code:
    *^C^C(command "_.cmdecho" "0" "_.layer" "_t" "com4" "_s" "com4" "" "_.textstyle" "dmt" "_.cmdecho" "1" "_.dimlinear" pause pause pause)
    Last edited by d_m_hopper; 2010-07-07 at 06:32 PM.

  4. #4
    Member
    Join Date
    2007-01
    Posts
    10
    Login to Give a bone
    0

    Default Re: Newbie question/request....

    Thanks for the replies. The tool palettes seem like a great simple way to get some standard tools set up.

    I'd like to get into looking at Macro's and advanced customisation but that will have to wait till I have a bit more time on my hands!

    Thanks again.

  5. #5
    I could stop if I wanted to
    Join Date
    2007-05
    Location
    Brookfield WI
    Posts
    331
    Login to Give a bone
    0

    Default Re: Newbie question/request....

    Quote Originally Posted by adam.buckley View Post

    I'd like to get into looking at Macro's
    I started here found at Cadalyst you can add the macro to the command you add to the palette..hope that makes sense

  6. #6
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    0

    Default Re: Newbie question/request....

    Quote Originally Posted by adam.buckley View Post
    I'd like to get into looking at Macro's
    Quote Originally Posted by d_m_hopper View Post
    sample macro
    Code:
    *^C^C(command "_.cmdecho" "0" "_.layer" "_t" "com4" "_s" "com4" "" "_.textstyle" "dmt" "_.cmdecho" "1" "_.dimlinear" pause pause pause)
    Tool palettes are simple, and Hopper's macro works fine (using AutoLISP vs. Diesel); it's all about how you choose to work.

    For example, here are some other methods for your consideration:
    Code:
    ^C^C^P._-layer;s;"LayerNameGoesHere";;._ dimlinear;\\\._layerp;^P
    ;;; This assumes the layer already exists within the active drawing
    ;;; No error handling if you hit escape during the command
    Or this:
    Code:
    (defun c:DIML ( / layerItem dimObj)
         (vl-load-com)
         (InsertErrorHandlerHere)
         (setvar 'cmdecho 0)
         ;; Layer check
         (if
              (tblsearch "layer" "LayerName")  ; If layer exists
               T  ; Then pass through
               (progn  ; Else make layer.
                   (setq layerItem 
                        (vla-add 
                             (vla-get-layers (vla-get-activedocument (vlax-get-acad-object))) 
                             "LayerName")
                   (vla-put-color layerItem ColorGoesHere)
                   (vla-put-description layerItem "DescriptionGoesHere"))) ;_end if
         ;; Create dimension
         (command "._dimlinear" pause pause pause)
         ;; Change dimension layer
         (setq dimObj (vlax-ename->vla-object (entlast)))
         (vla-put-layer dimObj "LayerName")
         (setvar 'cmdecho 1)
         (princ)) ;_end defun
    Or, if you really wanted to get all fancy like, you could just go with a CommandEnded reactor? Only when a dimension command ends (any of them), the callback function would programmatically place the dimension on the correct layer.

    The last one is probably overkill for what you are seeking, but possible, and very useful when used properly.

    There's a world of possible solutions, give them all a try - you never know which one will suite you best!

    Cheers!
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  7. #7
    AUGI Addict
    Join Date
    2008-02
    Posts
    1,141
    Login to Give a bone
    0

    Default Re: Newbie question/request....

    Keep in mind that if the user is unsuccessful creating the dimension, it will still change the layer of the last created entity. The best thing is to store the entlast before executing the dimension command. Once completed, you can change the layer if the new entlast is not equal to the one stored before the dimension command was executed. A nice CYA.

  8. #8
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    0

    Default Re: Newbie question/request....

    Quote Originally Posted by alanjt View Post
    Keep in mind that if the user is unsuccessful creating the dimension, it will still change the layer of the last created entity. The best thing is to store the entlast before executing the dimension command. Once completed, you can change the layer if the new entlast is not equal to the one stored before the dimension command was executed. A nice CYA.
    Good point, Alan.
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

Similar Threads

  1. 2014: New-Newbie question
    By cad-girl674485 in forum Revit MEP - General
    Replies: 4
    Last Post: 2014-06-24, 04:40 PM
  2. Newbie Question
    By tf11201 in forum AutoCAD Map 3D - Data Connect (FDO)
    Replies: 2
    Last Post: 2010-09-24, 01:27 PM
  3. newbie question
    By jbenoit44 in forum NavisWorks - General
    Replies: 2
    Last Post: 2010-09-09, 07:13 PM
  4. Newbie Request For help with Simple Wood Frame Walls and Floors
    By msaenz in forum Revit Architecture - General
    Replies: 5
    Last Post: 2007-08-21, 06:01 AM
  5. Question from a newbie...
    By mgerber in forum CAD Management - General
    Replies: 2
    Last Post: 2004-07-09, 04:41 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •