Stuck writing script to connect blocks

Stuck writing script to connect blocks

imegusta02
Participant Participant
372 Views
2 Replies
Message 1 of 3

Stuck writing script to connect blocks

imegusta02
Participant
Participant

Hello, I'm trying to write a LISP script to connect a series of blocks to each other using a polyline, I've written a script to place these blocks in an array since there are a few places in the array that require a different block, but now I want to connect the TOP point parameter to the BOTTOM point parameter of the block above it, yet I can't get it to recognize either the block and when it does I get an error stating that I have "too few arguments" could anyone help me get back on track or am I doing something that could be done differently? thanks in advance

0 Likes
373 Views
2 Replies
Replies (2)
Message 2 of 3

EnM4st3r
Advocate
Advocate

in line 34 you are using ssname without an index.:

 

(setq blocks (mapcar 'vlax-ename->vla-object (mapcar 'ssname (ssnamex ss))))

 

i would get the blockreferences like this:

 

(repeat (setq i (sslength ss))
    (setq blocks (cons (vlax-ename->vla-object (ssname ss (setq i (1- i)))) blocks))
)

 

 

0 Likes
Message 3 of 3

EnM4st3r
Advocate
Advocate

also your get-point-from-block
subfunction is returning an error for me.

You cant use getattributes to get parameters afaik.

You could get its values with

 

(vlax-invoke block-ref 'getdynamicblockproperties)

 

and then check for the propertyname and use vla-get-value.
But these points in my testing are fixed to the blocks location not the position in the modelspace

0 Likes