Author Topic: How to Filter an entsel?  (Read 7405 times)

0 Members and 1 Guest are viewing this topic.

matrix2005in

  • Guest
How to Filter an entsel?
« on: June 08, 2006, 10:15:51 AM »
HI

how can i add filter to this syntax

Code: [Select]
(setq sel (car(entsel "\nSelect Polyline")))

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: How to find vertex number
« Reply #1 on: June 08, 2006, 11:34:41 AM »
Code: [Select]
(prompt "\nSelect a polyline")
(setq ss (ssget "_+.:E:S" '((0 . "LWPOLYLINE,POLYLINE"))))
(and ss (setq sel (ssname ss 0)))
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

matrix2005in

  • Guest
Re: How to find vertex number
« Reply #2 on: June 09, 2006, 02:22:19 PM »
hi cab

gr8 it works the way i want..one more ..can you add closed polyline filter to this syntax?/
thanks

mathew

Jeff_M

  • King Gator
  • Posts: 4087
  • C3D user & customizer
Re: How to find vertex number
« Reply #3 on: June 09, 2006, 03:56:09 PM »
Select 1 closed pline....
Code: [Select]
(setq ss (ssget "_+.:E:S" '((0 . "LWPOLYLINE,POLYLINE")(-4 . "&")(70 . 1))))

matrix2005in

  • Guest
Re: How to find vertex number
« Reply #4 on: June 11, 2006, 11:21:32 AM »
hi jeff

thanks for the reply... 8-)

but that's not working.... :-(


Jeff_M

  • King Gator
  • Posts: 4087
  • C3D user & customizer
Re: How to find vertex number
« Reply #5 on: June 11, 2006, 12:22:57 PM »
It works here on Closed plines. If you manually close them, i.e. snap the last point to the start point, then it won't work.

And please, don't just say "it's not working".....post exatly what it does, or does not, do along with any error messages.

To test if this works just draw 2 "U" shaped plines, finish the second one with "C".
Now paste that one line of code I posted to the command line, select the first one and observe the command line output. Now paste the code to the command line again, select the second one and observe the output. The first should return nil, the second should return <Selection set: c>...where the "c' cand be any hex number.

matrix2005in

  • Guest
Re: How to find vertex number
« Reply #6 on: June 11, 2006, 01:39:16 PM »
Hi jeff
sorry for the confusion...your code will work to select only closed polyline..but i want a code that wont select closed polylines..thnaks
mathew

Jeff_M

  • King Gator
  • Posts: 4087
  • C3D user & customizer
Re: How to find vertex number
« Reply #7 on: June 11, 2006, 01:59:13 PM »
Now why didn't you say so to begin with? :-)
Code: [Select]
(setq ss (ssget "_+.:E:S" '((0 . "LWPOLYLINE,POLYLINE")
    (-4 . "<NOT")
    (-4 . "&")
    (70 . 1)
    (-4 . "NOT>")
    )))

matrix2005in

  • Guest
Re: How to find vertex number
« Reply #8 on: June 11, 2006, 02:44:22 PM »
hi jeff
its working gr8
but how can i select multiple objects???

thanks

mathew

Jeff_M

  • King Gator
  • Posts: 4087
  • C3D user & customizer
Re: How to find vertex number
« Reply #9 on: June 11, 2006, 02:56:01 PM »
Just remove the "_+.:E:S", CAB added that to mimic the (entsel) command as you asked for.

matrix2005in

  • Guest
Re: How to find vertex number
« Reply #10 on: June 11, 2006, 03:10:40 PM »
hi Jeff

thanks man for your instant replies

now everthing works fine....
:)

mathew

Jeff_M

  • King Gator
  • Posts: 4087
  • C3D user & customizer
Re: How to find vertex number
« Reply #11 on: June 11, 2006, 03:44:07 PM »
You're welcome! Someone has to hold down the fort on weekends ;-)

matrix2005in

  • Guest
Re: How to find vertex number
« Reply #12 on: June 12, 2006, 01:56:42 PM »
hi

I KNOW this may be very simple..but i am not getting proper solution..can you please help me..i just combined your code and other code to make pjoin..the problem is this works well with arcs,lines..but if selection set includes polyline then it will give error..code is posted below..
Code: [Select]
(defun C:PJOIN (/ SS2)
  (setq ss2 (ssget '((0 . "LWPOLYLINE,POLYLINE,LINE,ARC")
     (-4 . "<NOT")
     (-4 . "&")
     (70 . 1)
     (-4 . "NOT>")
    )
    )
  )

  (if (=  "LWPOLYLINE" ss2)
    (command "._PEDIT" "m" ss2 "" "_J" "" "")
    (command "._PEDIT" "m" ss2 "" "_Y" "_J" "" "")
    )
  (princ)
)

thanks
mathew

matrix2005in

  • Guest
Re: How to find vertex number
« Reply #13 on: June 12, 2006, 01:58:15 PM »
oops there is little mistake in that

Code: [Select]
(defun C:PJOIN (/ SS2)
  (setq ss2 (ssget '((0 . "LWPOLYLINE,POLYLINE,LINE,ARC")
     (-4 . "<NOT")
     (-4 . "&")
     (70 . 1)
     (-4 . "NOT>")
    )
    )
  )

  (if (=  "LWPOLYLINE" ss2)
    (command "._PEDIT" "m" ss2 "" "_J" "" "")
    (command "._PEDIT" "m" ss2 "" "_Y" "_J" "" "")
    )
  (princ)
)


Jeff_M

  • King Gator
  • Posts: 4087
  • C3D user & customizer
Re: How to find vertex number
« Reply #14 on: June 12, 2006, 03:00:15 PM »
What version of ACAD are you using, mathew?Nevermind....this should work regardless of version:
Code: [Select]
(defun C:PJOIN (/ SS2)
  (setq ss2 (ssget '((0 . "LWPOLYLINE,POLYLINE,LINE,ARC")
     (-4 . "<NOT")
     (-4 . "&")
     (70 . 1)
     (-4 . "NOT>")
    )
    )
  ) 

  (if (and ss2
              (or (not (setq pa (getvar "peditaccept")));;if this sysvar is not available
           (= pa 0);;or if it's set to 0
       )
   (ssget "P" '((0 . "LINE,ARC")));;and check to see if any non-plines are in the ss
   )
    (command "._PEDIT" "m" ss2 "" "_Y" "_J" "" "");;there are, so use the "Y" to convert
    (command "._PEDIT" "m" ss2 "" "_J" "" "")
    )
  (princ)
)
« Last Edit: June 12, 2006, 03:18:26 PM by Jeff_M »