CAFE

캐드 LISP

"속성" 별로 선택할 때 (setq ss (ssget "X" (list (cons 0 "CIRCLE") (cons -4 ">") (cons 40 1.25))))

작성자수호안다|작성시간15.09.16|조회수1,864 목록 댓글 0

6 - linetype

 

 

(setq lay_name "FLOOR3")
(setq ss1
  (ssget "X"   
    (list (cons 8 lay_name))
  )
)

 

 

(ssget "X"  (list  (cons 0 "CIRCLE")(cons 8 lay_name)(cons 62 3)))

 

(setq ss (ssget "X" (list (cons 0 "CIRCLE") (cons -4 ">") (cons 40 1.25))))

 

0 - entity type
2 - block
6 - linetype
7 - text style
8 - layer
38 - elevation - must be real number, e.g..: (38 . 2.5)
39 - thickness - must be real number, e.g..: (39 . 0.75)
62 - color (0 = "BYBLOCK", 256 = "BYLAYER")
66 - attributes follow flag, in insertion association lists
210 - 3D extrusion direction vector (list of 3 reals)

 

속성별로 select할때 (ssget "x" (list (cons 0 "text")))

ex) text나 lwpolyline이나 circle을 선택하고 싶을때

command: select
select: (ssget "x" (list (cons 0 "text")))
==>모든 text가 선택이 됩니다
==>(cons 0 "text,circle") 이런식이면 텍스트와 서클모두 선택합니다

글자로 select할때
ex) 사상구청을 선택하고 싶을때

command: select
select: (ssget "x" (list (cons 1 "사상구청")))
==>모든 "사상구청" text가 선택이 됩니다
==>(cons 1 "*학교*") 이런식이면 학교라는 글자가 들어가면 모두 선택합니다

레이어별로 select할때
ex) 레이어명 "주요건물"을 선택하고 싶을때

command: select
select: (ssget "x" (list (cons 8 "주요건물")))
==>"주요건물" 레이어가 모두 선택이 됩니다

색깔로 select할때
ex) red색깔을 선택하고 싶을때

command: select
select: (ssget "x" (list (cons 62 1)))
==>모든 red색깔을 가진 객체가 선택이 됩니다
==>bylayer는 256 입니다.

면형처리로 select할때
ex)면처리된 객체가 close가 된것을 선택하고 싶을때

command: select
select: (ssget "x" (list (cons 70 1)))
==>close된 모든 면형을 선택합니다
==>70 0 은 면처리가 안된것


응용
(ssget "x" (list (cons 8 "주요건물_text")(cons 1 "*학교*")))
이렇게 하면 주요건물_text라는 레이어중에서 학교라는 단어가
들어가는 모든 텍스트를 선택합니다.

그리고 선택된 객체들의 속성을 change하고 싶으시면
change
p
를 하셔서 바꾸고 싶으신 속성을 변환해주면 되겠죠?? ^^*

[출처] [AutoCad] "속성" 별로 선택할 때|작성자 레나도

=======================================================================

출처 : http://ronleigh.com/autolisp/afude18.htm

 

 

(setq ss (ssget "X" (list (cons 0 "CIRCLE") (cons -4 ">") (cons 40 1.25))))

Logical operators such as AND and OR can also be used with code -4. See AutoCAD R14 Customization Guide for more details.

(ssget "X") creates a selection set of all entities in the drawing including those on layers that are frozen or off.

Other group codes supported by the ssget "X" argument include:
0 - entity type
2 - block
6 - linetype
7 - text style
8 - layer
38 - elevation - must be real number, e.g..: (38 . 2.5)
39 - thickness - must be real number, e.g..: (39 . 0.75)
62 - color (0 = "BYBLOCK", 256 = "BYLAYER")
66 - attributes follow flag, in insertion association lists
210 - 3D extrusion direction vector (list of 3 reals)

ssget ..... Establishes a selection set and returns the name of the selection set

(ssget) allows user to create a selection set interactively (similar to the SELECT command). Objects are highlighted as usual.

(ssget (list 1.75 4.0)) creates a selection set consisting of the entity that passes through the given point

(ssget "L") creates a selection set consisting of the last entity added to the drawing database

(ssget "W" (list 1 1) (list 4 4)) creates a selection set consisting of all the entities fully inside the window designated by the given corners

(ssget "W" (setq p1 (getpoint "First point: ")) (getcorner p1 "Other point: ")) same as above, but allows user to locate points with pointer

(ssget "C" (list 1 1) (list 4 4)) creates a selection set consisting of all the entities inside or crossing the window designated by the given corners

(ssget "P") creates a selection set consisting of the entities from the previous selection set (for example, from a selection set just created with the SELECT command)

Other arguments can bu used, based on the standard options for building selection sets, such as WP, CP, F.

(ssget "X" (list (cons 8 "0"))) creates a selection set of all drawing entities on layer "0". The first argument ("X") causes the ssget function to scan all entities and compile a selection set composed only of those that pass the requirements indicated in the second argument. The second argument is an association list using appropriate group codes.

After (setq dp1 (cons 0 "ARC")), which creates the dotted pair (0 . "ARC") and assigns it to dp1,
(ssget "X" (list dp1)) creates a selection set of all arcs
(ssget "X" (list (cons 0 "CIRCLE") (cons 8 "HIDDEN") (cons 40 1.5))) creates a selection set of all circles that are on layer "Hidden" having a radius of 1.5. When two or more criteria are included in the second argument, all criteria must be met for the entity to be included in the selection set.

In the above example, the radius of a circle had to be exactly 1.5 to be included in the selection set. By using a code -4 and a relational operator before indicating the radius, you could select all circles with a radius greater than 1.25 as follows:
(setq ss (ssget "X" (list (cons 0 "CIRCLE") (cons -4 ">") (cons 40 1.25))))

Logical operators such as AND and OR can also be used with code -4. See AutoCAD R14 Customization Guide for more details.

(ssget "X") creates a selection set of all entities in the drawing including those on layers that are frozen or off.

Other group codes supported by the ssget "X" argument include:
0 - entity type
2 - block
6 - linetype
7 - text style
8 - layer
38 - elevation - must be real number, e.g..: (38 . 2.5)
39 - thickness - must be real number, e.g..: (39 . 0.75)
62 - color (0 = "BYBLOCK", 256 = "BYLAYER")
66 - attributes follow flag, in insertion association lists
210 - 3D extrusion direction vector (list of 3 reals)

The selection set consists of main entities only. Polyline vertices and block attributes are not included.

The selection set is typically assigned to a variable, as follows: (setq ss1 (ssget)) This selection set can be fed to AutoCAD whenever it is prompting for general object selection. For example, after entering ERASE and being prompted to select objects, you could enter !ss1 (assuming you have assigned a selection set to variable ss1). This selection set can also be used inside a command function: (command ".erase" ss1 "").

Selection sets do not carry over to subsequent editing sessions.

다음검색
현재 게시글 추가 기능 열기

댓글

댓글 리스트
맨위로

카페 검색

카페 검색어 입력폼