Jump to content

Recommended Posts

Posted

Hi all,

I was wondering if someone could help me with a lisp modyfication. 

I need to modify CopyBlockStoCurve lisp so I don't need to select each block individually co copy it to the curve. I thought why not copy a function from numpol, which numbers blocks according to a polyline. So I need the new CopyBlockStoCurve to arrange blocks on a curve, but in accordance with how the blocks are positioned on another polyline basiclly.

Can anyone help?

 

 

 

numpol.lspCopyBlocksToCurve.lsp

Posted

That's not a drawing, just images.

 

I don't see a curve.

 

Is the text part of the block?

 

Really need the drawing.

Posted

okay so these are dynamic blocks with attributes, thats why i use numpol to change attribute values acording to polyline i drew over them.

Now I want to use something like copyblockstocurve (wich works also with polylines) to align my blocks to new straight line in the same order numpol did the numering. So that I could use them to draw a scheme.

Example.dwg

Posted

Another give it a try.

; https://www.cadtutor.net/forum/topic/98615-copy-blocks-to-curve-according-to-another-curve/
; get blocks along a pline at any XY then redo as a straight line.
; By AlanH July 2025

(defun c:wow ( / bname co-ord ent obj plent pt spac ss x)

(setq oldsnap (getvar 'osmode))
(setvar 'osmode 0)

(setq plent (car (entsel "\pick pline joining blocks ")))
(setq obj (vlax-ename->vla-object (car (entsel "\nPick block object "))))
(setq pt (getpoint "\nPick left point "))
(setq spac (getreal "\Enter spacing "))
(setq bname (vlax-get obj 'effectivename))
(setq co-ord (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget plent))))

(setq ss (ssget "F" co-ord '((0 . "INSERT"))))

(command "line" pt (mapcar '+ pt (list (* (- (sslength ss) 1) spac) 0.0 0.0)) "")

(repeat (setq x (sslength ss))
 (setq ent (ssname ss (setq x (- x 1))))
 (setq obj (vlax-ename->vla-object ent))
 (if (= (vlax-get obj 'effectivename) bname)
 (progn
   (command "copy" ent "" (vlax-get obj 'Insertionpoint) pt)
   (setq pt (mapcar '+ pt (list spac 0.0 0.0)))
 )
 )
)

(princ)
)

 

Posted

@devitg Yours seams to not work for me at all 

 

@BIGAL I can't quite go through this routine to see final result. nothing happens after i daw a line. Also I already have a polyline that goes though all blocks that I need,  so the part in lisp that tells me to draw line over blocks is unnecessary

 

To be more precise. Lisp CopyBlockstocurve works great, the only part i want to change is that I dont want to click on each block to copy it to straight line. I want them to be copied automaticlly acording to pline that is existing

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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...