Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to insert block at every vertice of a polyline in lisp?

65 REPLIES 65
Reply
Message 1 of 66
Anonymous
6677 Views, 65 Replies

How to insert block at every vertice of a polyline in lisp?

I need a quick lisp that will insert a block on every vertice of a polyline.
(possibly a 3d polyline) Any help would be GREATLY appreciated. Thx!
65 REPLIES 65
Message 61 of 66
Kent1Cooper
in reply to: CHADK76


@CHADK76 wrote:

I could not find where to make the attribute increment in the block editor.


The incrementing is not in the Block definition, but in the answer to the Attribute value prompt, supplied by the code when the Block is inserted.

 

If my guess before [that you have a constant-value Attribute] is correct, you could make a new one to replace it, and ensure that it is not constant:

VertexAttribute1.JPG

Or, I think you can "fix" one that's defined to be constant by opening the Block in BEDIT, picking on the Attribute Definition, and in Properties, emptying out any content from the Value slot:

VertexAttribute2.JPG

 

Another possibility for a reason that they all say "1" is that you didn't  use an Attribute, but simply used a piece of Text or Mtext with content of "1" in the Block.  If so, replace that with an Attribute Definition.

Kent Cooper, AIA
Message 62 of 66
CHADK76
in reply to: Kent1Cooper

It is an attribute definition as shown in attachment. Do I need to add anything in the lisp file?

 

 

 

Message 63 of 66
Kent1Cooper
in reply to: CHADK76

But it has "1" in the "Value" slot [fuzzy from the low resolution of your image]:

VertexAttribute3.JPG

That's the constant value -- take that out.

 

HOWEVER, in quickie trial, I'm finding that if I do only that, when I then Insert one, it doesn't prompt for a value; there may be some other Property that you need to change, or you may need to replace it with a new one -- I'll leave it to you to experiment.

Kent Cooper, AIA
Message 64 of 66
CHADK76
in reply to: Kent1Cooper

I cleared the value for my attribute definition VERTEX in my block. I also set the attdia variable to 0 in my drawing. I am now getting the lisp to work, but it is starting with zero for my first vertice. I tried putting 1 in the value as a test and it still starts with zero. Do I need to add something else in the block to make it start with 1 instead of zero?

 

Thanks,

Chad

Message 65 of 66
Kent1Cooper
in reply to: CHADK76


@CHADK76 wrote:

.... it is starting with zero for my first vertice. ....


It uses the parameter values themselves, and for Polylines those start at zero for the first vertex.  Try replacing this:

  (itoa inc)
with this:

  (itoa (1+ inc))

Kent Cooper, AIA
Message 66 of 66
CHADK76
in reply to: Kent1Cooper

That did the trick. 

 

Thanks for all the help,

 

Chad

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost