Jump to content

Recommended Posts

Posted

I'd like the routine to

ssget 34doors and do this command

ssget 36doors and to that command.

lots of times there's only 34 or 36. rarely both in a single drawing but do not want to count it out in this routine.

 

I'm just not sure how to set this up...

 

(setq ss (ssget "_x" '((2 . "*door"))))
(cond ((= "34door" ss)
         (command ...
        )
        ((= "36door" ss)
         (command ...
        )
)

Posted

Step though the selection set index and evaluate the ename.

Posted

Why you want to select the ...... and invoking a command ?

Are these names of doors are blocks?

 

Give more details of your action to be clear to study the situations

by members.

 

Tharwat

Posted

Here is something to give you a start,

 (setq ss (ssget "_x" '((2 . "*door"))))
(if ss
 (progn
   (setq i     0
         total 0
         n     (sslength ss)
   )
   (while (< i n)
     (setq e (entget (ssname ss i)))
     (setq str (cdr (assoc [color="red"]0[/color] e)))
     (setq i (1+ i))
))
 (cond ((= "34door" str)(command .....))
     ((= "36door" str)(command .............))))

 

Add them to your codes, but not sure about the Entitys' types.

 

Tharwat

Posted
looked this up the same time I got your response

http://www.afralisp.net/autolisp/tutorials/selection-sets.php

 

Thank you! :D

No sweat. Give a shout if you need more help.

 

Know that if you are using command, it will only work on objects residing in your current layout, even though ssget "_X" will select everything in the entire drawing. Watch out for that and do a little extra filter *hint DXF 410*.

Posted
No sweat. Give a shout if you need more help.

 

I've been breaking my rule with bouncing around. I'm getting back on track now. I'm looking at entmake/mod and I was wondering how would I modify existing text. I tried to modify a routine on afralisp.net "chlayer" but I was unsuccessful.

 

 
(setq old (ssget "_x" '((1 . "blah*"))))
(setq new "hi")

 

This routine will be very useful to me because I do a lot of customer revisions

 

 

____

extra filter *hint DXF 410*.

 

I'll check that out, thanks

Posted

You can add 1 to your dxf filter in ssget, however, since it IS case sensitive, you can easily skip over things. You are better off to just select the text and then step through it.

 

eg. (replacing text with "PIZZA" with "BURGERS")

 

(defun c:Test (/ ss)
 (if (setq ss (ssget "_:L" '((0 . "TEXT"))))
   ((lambda (i / e s l)
      (while (setq e (ssname ss (setq i (1+ i))))
        (if (wcmatch (strcase (cdr (setq s (assoc 1 (setq l (entget e)))))) "PIZZA")
          (entmod (subst (cons 1 "BURGERS") s l))
        )
      )
    )
     -1
   )
 )
 (pricn)
)

Posted
You can add 1 to your dxf filter in ssget, however, since it IS case sensitive, you can easily skip over things. You are better off to just select the text and then step through it.

 

eg. (replacing text with "PIZZA" with "BURGERS")

 

(defun c:Test (/ ss)
 (if (setq ss (ssget "_:L" '((0 . "TEXT"))))
   ((lambda (i / e s l)
      (while (setq e (ssname ss (setq i (1+ i))))
        (if (wcmatch (strcase (cdr (setq s (assoc 1 (setq l (entget e)))))) "PIZZA")
          (entmod (subst (cons 1 "BURGERS") s l))
        )
      )
    )
     -1
   )
 )
 [color=black](princ)[/color]
)

 

Thanks! I have a lot of learning to do!

Posted
Thanks! I have a lot of learning to do!
If you work with annotative text' date=' you may want to refrain from entmod'ing text; it will result in GIANT text objects. It's best to extract the string with entget (bug with extracting symbols with vla-get-textstring) and vla-put-textstring to place the string.
Posted

Luckly I do not. But thanks for the heads up. Visual lisp is on my list of things to learn. I didn't want to try both at once so that's why I'm doing autolisp for now.

Posted
Luckly I do not. But thanks for the heads up. Visual lisp is on my list of things to learn. I didn't want to try both at once so that's why I'm doing autolisp for now.
Probably not a bad idea. I'll try and remember to offer entmod/entmake examples for you.

 

You'll soon learn that VL is a lot less legwork, more times than not and entmod just doesn't always work on a lot of the newer options.

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...