sadhu Posted December 1, 2011 Posted December 1, 2011 I need to count text and block entities by color. These objects can be on the same layer or different layers. What is the dxf code for color ? if that is the right direction to go. thanks Quote
Lee Mac Posted December 1, 2011 Posted December 1, 2011 This function will return the colour of an entity: (defun _getentitycolour ( ent ) (abs (cond ( (cdr (assoc 62 (entget ent)))) ( (cdr (assoc 62 (tblsearch "LAYER" (cdr (assoc 8 (entget ent))))))) ) ) ) [ The layer colour if set to ByLayer ] As for the counting side, I would recommend you use an 'Assoc++' function, demonstrated here. Quote
marko_ribar Posted December 1, 2011 Posted December 1, 2011 You can use "QSELECT" command and switch filter by color, change color to desired, and choose entities to apply filter. You must firstly choose either blocks or text objects and then continue to append to selection with other entity type... After selection has been created, use : (sslength (ssget "_P")) it should return number of objects in selection set... Hope this helps, M.R. Quote
Recommended Posts
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.