PDA

View Full Version : Getting an entities layer



hroark
2004-10-29, 11:35 PM
Hi Forum Members,

It's been several years since I last wrote any code and am now having a problem when asked to modify some existing code.

We are trying to offset a line a specific distance to each side, change the linetype of the original line and place it on a specific layer. I've got everything but the part about the layer under control. I just can't think of a way to change the layer.

Could anyone out there offer a suggestion?

On another front, I have a very large "street map" (probably 30 or 40 square miles) with a grid breaking it up into a couple hundred sections. Our client wants us to break each line as it crosses each gridline.... in effect, making each section into a separate "drawing". Does anyone have any suggestions how this can be done efficiently and expeditiously?

TIA

Tom Sigler

David.Hoole
2004-11-01, 09:42 AM
Hi Tom

This snippet should illustrate the simplest method:

(vl-load-com)
(setq entity_name (car (entsel)))
(setq object (vlax-ename->vla-object entity_name))
(vla-put-layer object "LAYER_NAME")

Make sure the layer LAYER_NAME exists before running this.

Hope this helps.

David.Hoole
2004-11-01, 09:46 AM
Oops! Forgot your second question.

Personally, I would leave the drawing as a single file & use clipped xrefs to make the individual zone drawings. Much more efficient in my opinion.
There may be reasons why this wouldn't be practical, such as multi-user access, but couldn't say without more background info.

tsigler
2004-11-01, 01:29 PM
Thanks, David

I'll incorporate that code and see what comes of it. As for the second part of my question, unfortunately Xref is not an option with this client.

Thanks again, Tom