Page 4 of 4 FirstFirst 1234
Results 31 to 37 of 37

Thread: Is there a way to access selection sets in a script?

  1. #31
    AUGI Addict .T.'s Avatar
    Join Date
    2000-12
    Location
    Lost
    Posts
    1,473
    Login to Give a bone
    0

    Default Re: Is there a way to access selection sets in a script?

    Quote Originally Posted by ahefner
    Wow, the weird limitations you come across just trying to automate the simplest of tasks.

    Help would be great.

    Here's the idea... I have some xrefs which the architect has added POLYLINEs with a thickness to represent the bathroom stalls and hand rails. I simply need to explode the PLINEs so they loose their thickness and are controlled "bylayer". My button macro reads as follows:
    Code:
    ^C^CZOOM;e;EXPLODE;(ssget "_X" '((0 . "LWPOLYLINE,POLYLINE")));
    Is there a somewhat simple way to adapt what that link was talking about (btw, thanks for the link) to accomplish the task described above?
    I need to do a little research on tilemode, ctab, and how to handle going through a viewport, (maybe someone will jump in here and help with that. Please!) but this is a quick and dirty start:

    Code:
    (defun c:explodeplines ( / ss cnt)
      (setq ss (ssget "X" (list (cons 0 "LWPOLYLINE,POLYLINE");select all polylines
                                (cons 410 (getvar "ctab"))    ;in current tab
                          )
               )
      )
      (repeat (setq cnt (sslength ss))
         (command "explode" (ssname ss (setq cnt (1- cnt))))
      )
    (princ)
    )
    At least it works for model space and doesn't do the other tabs if you are in model space.

    Just in case; I don't know how experienced you are: Copy the code to a text file with a .lsp extension and save it somewhere in your support directories. Then type (load "whateveryoucalledit") at the command line. If you need help automating that, let us know. You might want to have a look at RK's blog for some tips on setting up customizations, also.

    Once loaded, the macro could be

    Code:
    ^C^CZOOM;e;explodeplines;
    HTH

  2. #32
    100 Club
    Join Date
    2007-05
    Location
    Fort Worth, Texas Cowtown USA
    Posts
    139
    Login to Give a bone
    0

    Default Re: Is there a way to access selection sets in a script?

    I've somewhat got button macros and scripts down, and know how to slightly modify a lisp, but can't write them from scratch (at least not yet, ). Like I know I can change below "(defun c:explodeplines..." to "(defun c:XPL" and that will change the command prompt entry to 'XPL' instead of 'explodeplines'.

    Anyway... everything I'm dealing with is in MS, so no PS changing needed and actually would like to ignore PS (extra tabs) if possible.

    Thanks a million.

    (Yeah, I already have my customization setup like RK's blog. Except I have mine saved on C and the network, and update both locations everytime I make a change)

  3. #33
    AUGI Addict .T.'s Avatar
    Join Date
    2000-12
    Location
    Lost
    Posts
    1,473
    Login to Give a bone
    0

    Default Re: Is there a way to access selection sets in a script?

    Quote Originally Posted by ahefner
    I've somewhat got button macros and scripts down, and know how to slightly modify a lisp, but can't write them from scratch (at least not yet, ). Like I know I can change below "(defun c:explodeplines..." to "(defun c:XPL" and that will change the command prompt entry to 'XPL' instead of 'explodeplines'.

    Anyway... everything I'm dealing with is in MS, so no PS changing needed and actually would like to ignore PS (extra tabs) if possible.

    Thanks a million.
    You're welcome. Let us know if you have any problems with it.

    As long as you are in model space, it will only do the ones in model space at this point.

  4. #34
    AUGI Addict .T.'s Avatar
    Join Date
    2000-12
    Location
    Lost
    Posts
    1,473
    Login to Give a bone
    0

    Default Re: Is there a way to access selection sets in a script?

    Quote Originally Posted by ahefner
    Here's the idea... I have some xrefs which the architect has added POLYLINEs with a thickness to represent the bathroom stalls and hand rails. I simply need to explode the PLINEs so they loose their thickness and are controlled "bylayer".

    I just noticed this. Would it be easier to change the width and whatever you need bylayer properties of the polylines and leave them as polylines? We can do that.

  5. #35
    100 Club
    Join Date
    2007-05
    Location
    Fort Worth, Texas Cowtown USA
    Posts
    139
    Login to Give a bone
    0

    Default Re: Is there a way to access selection sets in a script?

    Quote Originally Posted by timcreary
    I just noticed this. Would it be easier to change the width and whatever you need bylayer properties of the polylines and leave them as polylines? We can do that.

    Yeah, I just need the thicknesses gone so my text isn't covered up.

  6. #36
    100 Club
    Join Date
    2007-05
    Location
    Fort Worth, Texas Cowtown USA
    Posts
    139
    Login to Give a bone
    0

    Default Re: Is there a way to access selection sets in a script?

    I guess I couldn't see the solution due to the problem

    Code:
    PE;m;(ssget "_x" '((0 . "polyline,lwpolyline")));;w;0;;

  7. #37
    I could stop if I wanted to
    Join Date
    2015-08
    Posts
    263
    Login to Give a bone
    0

    Default Re: Is there a way to access selection sets in a script?

    Quote Originally Posted by ahefner
    I guess I couldn't see the solution due to the problem

    Code:
    PE;m;(ssget "_x" '((0 . "polyline,lwpolyline")));;w;0;;
    If you have express tools loaded, I would suggest to use MPEDIT command.
    Also, please try to use the native command (for example, type _.pedit). It will give you error free code.

    Regards,
    AH

Page 4 of 4 FirstFirst 1234

Similar Threads

  1. ...Selection sets...
    By davidmatyas in forum VBA/COM Interop
    Replies: 15
    Last Post: 2008-04-02, 07:14 PM
  2. Run a script that sets Variables from a button or drawing startup.
    By SRBalliet in forum AutoCAD Customization
    Replies: 9
    Last Post: 2006-02-21, 11:45 AM
  3. Other (selection sets)
    By gketter in forum AutoCAD LT - Wish List
    Replies: 5
    Last Post: 2005-10-26, 07:11 AM
  4. How to access AutoCAD selection sets
    By venablescranes in forum VBA/COM Interop
    Replies: 2
    Last Post: 2005-02-20, 11:34 PM
  5. Help relating to selection and selection sets
    By csgohjmj in forum AutoLISP
    Replies: 3
    Last Post: 2004-09-17, 03:35 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
  •