• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    Visual LISP, AutoLISP and General Customization

    Reply
    Contributor
    Posts: 13
    Registered: ‎03-04-2007
    Accepted Solution

    Create a menu option to draw a polyline of varying segments

    288 Views, 4 Replies
    02-10-2011 01:24 PM

    I am drawing evacuation signs at the moment.  I would like to create a menu option that allows me to draw a polyline to show the exit path and then change it's color and linetype.  I would also like to fillet the corners of the newly created line.

     

    My immediate challenge is to create the menu option that draws the polyline with varying number of segments

     

    ^C^C_pline\\\\ this would pause four times for input, but the pline may be 1 to 20 segments for example.

     

    It seems that I can't do this as a macro in the menu can anyone show me another way.

     

    Thanks,

    Alan

    Please use plain text.
    *Expert Elite*
    Kent1Cooper
    Posts: 4,078
    Registered: ‎09-13-2004

    Re: Create a menu option to draw a polyline of varying segments

    02-10-2011 01:40 PM in reply to: alan.rackham

    alan.rackham wrote:

    ....I would like to ... draw a polyline ... and then change it's color and linetype.  I would also like to fillet the corners of the newly created line.

    ... with varying number of segments

     

    ^C^C_pline\\\\ this would pause four times for input, but the pline may be 1 to 20 segments for example.

    ....


    It's the old keep-pausing-for-User-input-until-the-command-is-done situation, which you can do using the CMDACTIVE System Variable.  Fortunately, you can use Lisp expressions in macros.  Something like this [untested]:

     

    ^C^C_pline (while (> (getvar 'cmdactive) 0) (command pause)) +

    _chprop L ;_color yourcolor _ltype yourlinetype ;+

    _fillet _radius yourradius _polyline _last

    Kent Cooper
    Please use plain text.
    Contributor
    Posts: 13
    Registered: ‎03-04-2007

    Re: Create a menu option to draw a polyline of varying segments

    02-10-2011 03:00 PM in reply to: alan.rackham

    Kent

     

    Thanks for your response.  I get the idea, but I get this message on the screen:-

     

    Specify start point: (while (> (getvar "cmdactive") 0) (command pause)) _chprop
    Invalid point.

     

    Alan

    Please use plain text.
    Contributor
    Posts: 13
    Registered: ‎03-04-2007

    Re: Create a menu option to draw a polyline of varying segments

    02-10-2011 04:12 PM in reply to: alan.rackham

    Kent

     

    Thanks for the tip.  My final solution was to write it in lisp and load it using the ribbon menu.  Here's my final lisp for anyone that is interested:-

     

    (defun c:MEP ()
      (command "pline")
      (while (> (getvar "cmdactive") 0) (command pause))
      (command "chprop" "L" "" "Color" "Yellow" "ltype" "EvacPathLine" "")
      (command "fillet" "radius" "1.5" "fillet" "polyline" "L")
      (command "pedit" "L" "width" "1.5" "")
    )

    Thanks,

    Alan

    Please use plain text.
    *Expert Elite*
    Kent1Cooper
    Posts: 4,078
    Registered: ‎09-13-2004

    Re: Create a menu option to draw a polyline of varying segments

    02-11-2011 04:58 AM in reply to: alan.rackham

    alan.rackham wrote:

    ...I get this message on the screen:-

     

    Specify start point: (while (> (getvar "cmdactive") 0) (command pause)) _chprop
    Invalid point.

    ....


    That's interesting.  I have various macros that include Lisp functions, so I assumed any Lisp function would work in a macro.  But I don't have any with (while) functions -- it looks as though those can't be used that way, for some reason.  That's good to know, at least, if only because there may be others like that, so I shouldn't assume....

     

    I would have next suggested the fully-Lisp approach instead, but it looks like you've figured that out.

    Kent Cooper
    Please use plain text.