Jump to content

Changing color of blocks according to elevation attribute


Recommended Posts

Hi everyone,

I imported some bathymetric coordinates to AUTOCAD map 3d, they appeared as individual blocks, the numbers with a centered cross. I kept only the elevation attribute, adjusting size and position. After that, I had some issues, following:


I have to put them into a map, in different sizes and rotation angles according to the place, I made different blocks, separating above 10 meters and below 10 meters, because of the position of the numbers (have to be centered, matching the comma with the cross, and they vary depending on the numbers - 1 and 2 digits), and the blocks got mixed in their properties (size and color). I left them like that for a while, because I did manually, but I'm trying to solve this with some routine or queries.


I also need to classify the different depths with colors, according to the location. Is there a way to do it? Is it better to change from blocks to text? I'm trying to do a query for that, but is not working for blocks or text, I guess I am doing something wrong. Could you please, help me? Thanks in advance.

Link to comment
Share on other sites

Hi, there are thousands of numbers. That's why I'm trying to work with blocks and queries, if it's possible. Follows a sample attached[ATTACH=CONFIG]56794[/ATTACH][ATTACH=CONFIG]56794[/ATTACH]

Link to comment
Share on other sites

It would probably be easier to test any proposed solutions if you were to attach an actual copy of the .DWG file. Images, in most cases, are just pretty pictures and that's about it.

Link to comment
Share on other sites

Hi, I send an example. The numbers in black are the minimum zone depth and all the blue values which are below this should have red color, according to the stated for the zone.

Is there a way to do this at once? A lisp/query/etc.?

Thanks in advance

Link to comment
Share on other sites

Try this


; change color of a block
; by Alan H Feb 2016 

(defun c:rlred ( / rl len x val)

(setq rl (atof (vla-get-textstring 
        (car (entsel "Pick rl"))))))

(setq ss1 (ssget (list (cons 0 "INSERT")(cons 2 "Map_Survey_Point"))))
(setq len (sslength ss1))
(setq x len)
(repeat len
(foreach att (vlax-invoke (vlax-ename->vla-object (ssname SS1 (setq x (- x 1)) )) 'getattributes)
(setq val (atof (vla-get-textstring att)))
(if (< val rl)
(vla-put-color att 10)
(command "regen")

Link to comment
Share on other sites

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.

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