Jump to content

Align Objects to Curve - Multiple


Merve

Recommended Posts

Hi everyone

I'm using LeeMac's Align objects to Curve lisp. But i need to do it multiple like a chain.

It may be like array option of copy command.

-enter number of items to align

-distance between objects etc

 

Thank you all especially Lee Mac :)

Link to comment
Share on other sites

And you can't use the MEASURE or DIVIDE command with the Block and "Align block with object" options because.............?

Link to comment
Share on other sites

If you look at this lisp it draws a block repeatedly along a pline, using a spacing increment. It also uses two points to rotate correctly. The same theory could be applied to a chain link with a UP & Down link iteration. To test just make a block with a horizontal line 3.05 long with insertion point on right end.

 

(Defun draw_vehicle ( )

(SETQ ANGBASEE (GETVAR "ANGBASE"))
(SETQ ANGDIRR (GETVAR "ANGDIR"))
(SETQ LUNITSS (GETVAR "LUNITS"))
(SETQ LUPRECC (GETVAR "LUPREC"))
(SETQ AUNITSS (GETVAR "AUNITS"))
(SETQ AUPRECC (GETVAR "AUPREC"))
(setq oldsnap (getvar "osmode"))

(SETVAR "LUNITS" 2)
(SETVAR "ANGBASE" 0.0)
(SETVAR "ANGDIR" 0)
(SETVAR "LUPREC" 0)
(SETVAR "AUNITS" 3)
(SETVAR "AUPREC" 0)
(setvar "osmode" 0)

;(if (tblsearch "Block" "Holden")
;(princ "Holden")
;(progn
;(command "Insert" "p:\\Autodesk\\vba\\holdencar.dwg" "0,0" 1 1 0)
;(command "erase" "last" "")
 ; progn


(setq obj (vlax-ename->vla-object (car (entsel "\nPick Pline"))))

(setq interval ( getreal "\nEnter spacing m:"))

(setq cRad 3.05)
(setq startang (* pi 1.5))
(setq endang (/ pi 2.0))
(setq dist 0.0)

(setq len (vla-get-length obj))
(setq stpt (vlax-curve-getpointatdist obj interval))

(setq num (+ 1 (fix ( / len interval))))

(repeat num
(command "arc" "C" stpt (polar stpt endang crad)(polar stpt startang crad))
(setq objarc (vlax-ename->vla-object (entlast)))

(if (= (setq intpt (vlax-invoke obj 'intersectWith objarc acExtendnone)) nil)
(setq intpt (vlax-invoke obj 'intersectWith objarc acExtendThisEntity)) ; needed at start
)

(vla-delete objarc)
(setq ang (angle intpt stpt))


(command "Insert" "Holden" stpt 1 1 ang) ; need ang in radians

(setq stpt (vlax-curve-getpointatdist obj (setq dist (+ dist interval))))

) ; repeat

(SETVAR "LUNITS" lunitss)
(SETVAR "ANGBASE" angbasee)
(SETVAR "ANGDIR" angdirr)
(SETVAR "LUPREC" luprecc)
(SETVAR "AUNITS" aunitss)
(SETVAR "AUPREC" auprecc)

(princ)



) ; defun

(draw_vehicle)

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.

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