Visual LISP, AutoLISP and General Customization
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
*Fatfreek
List showing handle, color, and byblock or bylayer?
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
108 Views, 5 Replies
08-21-2006 06:06 PM
I need to make a list of all plines. For each pline I need to extract 1.
the entity handle, 2. the color, and 3. whether that color is by layer or by
block.
I'm somewhat bothered by the object data insofar as color is concerned.
(setq EntObj (vlax-ename->vla-object EntName))
From EntObj I read both index color and true color.
I need to know which it is. I also see nothing in EntObj about whether the
color is by layer or block.
Any suggestions?
Len Miller
--
To email reply, eradicate all threes in my SPAM guarded address.
the entity handle, 2. the color, and 3. whether that color is by layer or by
block.
I'm somewhat bothered by the object data insofar as color is concerned.
(setq EntObj (vlax-ename->vla-object EntName))
From EntObj I read both index color and true color.
I need to know which it is. I also see nothing in EntObj about whether the
color is by layer or block.
Any suggestions?
Len Miller
--
To email reply, eradicate all threes in my SPAM guarded address.
Re: List showing handle, color, and byblock or bylayer?
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
08-22-2006 12:05 AM in reply to:
*Fatfreek
Hi
Is this good for what you need ?
(defun c
line->list (/ ss n pl e_lst lst)
(setq ss (ssget '((0 . "LWPOLYLINE"))))
(if ss
(repeat (setq n (sslength ss))
(setq pl (ssname ss (setq n (1- n)))
e_lst (entget pl)
lst (cons (list (cons 1 (cdr (assoc 5 e_lst)))
(cons 2 (cond
((= (cdr (assoc 62 e_lst)) 0)
"BYBLOCK"
)
((or (null (cdr (assoc 62 e_lst)))
(= (cdr (assoc 62 e_lst)) 256)
)
"BYLAYER"
)
(T (cdr (assoc 62 e_lst)))
)
)
)
lst
)
)
)
)
(mapcar 'print lst)
(princ)
)
Is this good for what you need ?
(defun c
(setq ss (ssget '((0 . "LWPOLYLINE"))))
(if ss
(repeat (setq n (sslength ss))
(setq pl (ssname ss (setq n (1- n)))
e_lst (entget pl)
lst (cons (list (cons 1 (cdr (assoc 5 e_lst)))
(cons 2 (cond
((= (cdr (assoc 62 e_lst)) 0)
"BYBLOCK"
)
((or (null (cdr (assoc 62 e_lst)))
(= (cdr (assoc 62 e_lst)) 256)
)
"BYLAYER"
)
(T (cdr (assoc 62 e_lst)))
)
)
)
lst
)
)
)
)
(mapcar 'print lst)
(princ)
)
Gilles Chanteau
*Fatfreek
Re: List showing handle, color, and byblock or bylayer?
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
08-22-2006 02:09 PM in reply to:
*Fatfreek
Gile,
Great work. You've got two out of the three, the handle and the
ByBlock/ByLayer state. I'm now trying to get a sense of your flow to see if
I can figure the color, specifically when it's a True Color value.
Thank you.
Len
--
To email reply, eradicate all threes in my SPAM guarded address.
wrote in message news:5301753@discussion.autodesk.com...
Hi
Is this good for what you need ?
(defun c
line->list (/ ss n pl e_lst lst)
(setq ss (ssget '((0 . "LWPOLYLINE"))))
(if ss
(repeat (setq n (sslength ss))
(setq pl (ssname ss (setq n (1- n)))
e_lst (entget pl)
lst (cons (list (cons 1 (cdr (assoc 5 e_lst)))
(cons 2 (cond
((= (cdr (assoc 62 e_lst)) 0)
"BYBLOCK"
)
((or (null (cdr (assoc 62 e_lst)))
(= (cdr (assoc 62 e_lst)) 256)
)
"BYLAYER"
)
(T (cdr (assoc 62 e_lst)))
)
)
)
lst
)
)
)
)
(mapcar 'print lst)
(princ)
)
Great work. You've got two out of the three, the handle and the
ByBlock/ByLayer state. I'm now trying to get a sense of your flow to see if
I can figure the color, specifically when it's a True Color value.
Thank you.
Len
--
To email reply, eradicate all threes in my SPAM guarded address.
Hi
Is this good for what you need ?
(defun c
(setq ss (ssget '((0 . "LWPOLYLINE"))))
(if ss
(repeat (setq n (sslength ss))
(setq pl (ssname ss (setq n (1- n)))
e_lst (entget pl)
lst (cons (list (cons 1 (cdr (assoc 5 e_lst)))
(cons 2 (cond
((= (cdr (assoc 62 e_lst)) 0)
"BYBLOCK"
)
((or (null (cdr (assoc 62 e_lst)))
(= (cdr (assoc 62 e_lst)) 256)
)
"BYLAYER"
)
(T (cdr (assoc 62 e_lst)))
)
)
)
lst
)
)
)
)
(mapcar 'print lst)
(princ)
)
*Fatfreek
Re: List showing handle, color, and byblock or bylayer?
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
08-22-2006 02:23 PM in reply to:
*Fatfreek
For what it's worth, attached is my test drawing with a variety of plines,
colored in different ways.
Len
--
To email reply, eradicate all threes in my SPAM guarded address.
wrote in message news:5301753@discussion.autodesk.com...
Hi
Is this good for what you need ?
(defun c
line->list (/ ss n pl e_lst lst)
(setq ss (ssget '((0 . "LWPOLYLINE"))))
(if ss
(repeat (setq n (sslength ss))
(setq pl (ssname ss (setq n (1- n)))
e_lst (entget pl)
lst (cons (list (cons 1 (cdr (assoc 5 e_lst)))
(cons 2 (cond
((= (cdr (assoc 62 e_lst)) 0)
"BYBLOCK"
)
((or (null (cdr (assoc 62 e_lst)))
(= (cdr (assoc 62 e_lst)) 256)
)
"BYLAYER"
)
(T (cdr (assoc 62 e_lst)))
)
)
)
lst
)
)
)
)
(mapcar 'print lst)
(princ)
)
colored in different ways.
Len
--
To email reply, eradicate all threes in my SPAM guarded address.
Hi
Is this good for what you need ?
(defun c
(setq ss (ssget '((0 . "LWPOLYLINE"))))
(if ss
(repeat (setq n (sslength ss))
(setq pl (ssname ss (setq n (1- n)))
e_lst (entget pl)
lst (cons (list (cons 1 (cdr (assoc 5 e_lst)))
(cons 2 (cond
((= (cdr (assoc 62 e_lst)) 0)
"BYBLOCK"
)
((or (null (cdr (assoc 62 e_lst)))
(= (cdr (assoc 62 e_lst)) 256)
)
"BYLAYER"
)
(T (cdr (assoc 62 e_lst)))
)
)
)
lst
)
)
)
)
(mapcar 'print lst)
(princ)
)
*Jeff Mishler
Re: List showing handle, color, and byblock or bylayer?
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
08-22-2006 03:05 PM in reply to:
*Fatfreek
How about something like this?
[code]
(defun poly_list (/ ss obj tmp master)
(if (setq ss (mapcar 'cadr (ssnamex (ssget "x" '((0 . "LWPOLYLINE"))))))
(progn
(foreach ent ss
(setq obj (vlax-ename->vla-object ent)
color (vla-get-truecolor obj)
method (vla-get-colormethod color)
)
(cond ((= method acColorMethodByLayer)
(setq cType "Bylayer"
colorNum 256)
)
((= method acColorMethodByBlock)
(setq cType "ByBlock"
colorNum 0)
)
((= method acColorMethodByRGB)
(setq cType "RGB"
colorNum (list (vla-get-red color)
(vla-get-green color)
(vla-get-blue color)
)
)
)
((= method acColorMethodByACI)
(setq cType "ACI"
colorNum (vla-get-entitycolor color))
)
(t
(setq cType "ForeGround"
colorNum "NotSureAboutThis")
)
)
(setq tmp (list (vla-get-handle obj)
colorNum
cType
))
(setq master (cons tmp master))
)
)
)
)
[/code]
"Fatfreek" wrote in message
news:5303109@discussion.autodesk.com...
For what it's worth, attached is my test drawing with a variety of plines,
colored in different ways.
Len
--
To email reply, eradicate all threes in my SPAM guarded address.
wrote in message news:5301753@discussion.autodesk.com...
Hi
Is this good for what you need ?
(defun c
line->list (/ ss n pl e_lst lst)
(setq ss (ssget '((0 . "LWPOLYLINE"))))
(if ss
(repeat (setq n (sslength ss))
(setq pl (ssname ss (setq n (1- n)))
e_lst (entget pl)
lst (cons (li
st (cons 1 (cdr (assoc 5 e_lst)))
(cons 2 (cond
((= (cdr (assoc 62 e_lst)) 0)
"BYBLOCK"
)
((or (null (cdr (assoc 62 e_lst)))
(= (cdr (assoc 62 e_lst)) 256)
)
"BYLAYER"
)
(T (cdr (assoc 62 e_lst)))
)
)
)
lst
)
)
)
)
(mapcar 'print lst)
(princ)
)
[code]
(defun poly_list (/ ss obj tmp master)
(if (setq ss (mapcar 'cadr (ssnamex (ssget "x" '((0 . "LWPOLYLINE"))))))
(progn
(foreach ent ss
(setq obj (vlax-ename->vla-object ent)
color (vla-get-truecolor obj)
method (vla-get-colormethod color)
)
(cond ((= method acColorMethodByLayer)
(setq cType "Bylayer"
colorNum 256)
)
((= method acColorMethodByBlock)
(setq cType "ByBlock"
colorNum 0)
)
((= method acColorMethodByRGB)
(setq cType "RGB"
colorNum (list (vla-get-red color)
(vla-get-green color)
(vla-get-blue color)
)
)
)
((= method acColorMethodByACI)
(setq cType "ACI"
colorNum (vla-get-entitycolor color))
)
(t
(setq cType "ForeGround"
colorNum "NotSureAboutThis")
)
)
(setq tmp (list (vla-get-handle obj)
colorNum
cType
))
(setq master (cons tmp master))
)
)
)
)
[/code]
"Fatfreek"
news:5303109@discussion.autodesk.com...
For what it's worth, attached is my test drawing with a variety of plines,
colored in different ways.
Len
--
To email reply, eradicate all threes in my SPAM guarded address.
Hi
Is this good for what you need ?
(defun c
(setq ss (ssget '((0 . "LWPOLYLINE"))))
(if ss
(repeat (setq n (sslength ss))
(setq pl (ssname ss (setq n (1- n)))
e_lst (entget pl)
lst (cons (li
st (cons 1 (cdr (assoc 5 e_lst)))
(cons 2 (cond
((= (cdr (assoc 62 e_lst)) 0)
"BYBLOCK"
)
((or (null (cdr (assoc 62 e_lst)))
(= (cdr (assoc 62 e_lst)) 256)
)
"BYLAYER"
)
(T (cdr (assoc 62 e_lst)))
)
)
)
lst
)
)
)
)
(mapcar 'print lst)
(princ)
)
*Fatfreek
Re: List showing handle, color, and byblock or bylayer?
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
08-22-2006 04:05 PM in reply to:
*Fatfreek
Beautiful, Jeff. I am forever grateful.
Len.
--
To email reply, eradicate all threes in my SPAM guarded address.
"Jeff Mishler" wrote in message
news:5303209@discussion.autodesk.com...
How about something like this?
[code]
Len.
--
To email reply, eradicate all threes in my SPAM guarded address.
"Jeff Mishler"
news:5303209@discussion.autodesk.com...
How about something like this?
[code]
