Multiple Constraints along Array path

Multiple Constraints along Array path

Anonymous
Not applicable
3,687 Views
12 Replies
Message 2 of 13

Multiple Constraints along Array path

Anonymous
Not applicable

Afternoon All,

 

     I am attempting to model a piece that will move along a conveyor path. It will be constrained by two hanging points. I cannot get the array path command to constraint both hanging points along the path. It will only seem to constrain the single point I click around the array. A screenshot of what I'm attempting to achieve is here, as well as a shot of the piece. Please let me know if anyone needs anything else. Sorry, I know it seems elementary, but I cannot solve this problem! Thanks in advance all!

 

 

 

array.JPGblock.JPG

 

 

0 Likes
3,688 Views
12 Replies
Replies (12)
Message 1 of 13

Anonymous
Not applicable

Afternoon All,

 

     I am attempting to model a piece that will move along a conveyor path. It will be constrained by two hanging points. I cannot get the array path command to constraint both hanging points along the path. It will only seem to constrain the single point I click around the array. A screenshot of what I'm attempting to achieve is here, as well as a shot of the piece. Please let me know if anyone needs anything else. Sorry, I know it seems elementary, but I cannot solve this problem! Thanks in advance all!

 

 

 

array.JPGblock.JPG

 

 

0 Likes
Message 3 of 13

john.vellek
Alumni
Alumni

Hi @Anonymous,

 

Is it possible to share your drawing file too? It is a little hard for me to understand the two constraining points. it would help if I could see what you have tried already.


John Vellek


Join the Autodesk Customer Council - Interact with developers, provide feedback on current and future software releases, and beta test the latest software!

Autodesk Knowledge Network | Autodesk Account | Product Feedback
0 Likes
Message 4 of 13

Anonymous
Not applicable

@john.vellek, Please find a dwg attached with three sections, one where I've arrayed and constrained each one manually, one where I've attempted an array, and the original pieces.

0 Likes
Message 5 of 13

Ranjit_Singh
Advisor
Advisor

I think array allows only 1 constraint point. You will need some custom routine to add another constraint. Search the LISP forums; someone may have a routine already. Or maybe move your thread to the LISP forums and someone can write a routine.

0 Likes
Message 6 of 13

Anonymous
Not applicable
@Admin could you please move this thread to the LISP customization forum? Hopefully I can find some luck over there! Thank you in advance. (maybe @john.vellek could do this??) Have a great afternoon all!
0 Likes
Message 7 of 13

parkr4st
Advisor
Advisor

this looks like an AD Inventor problem?  Jvellek opinion?

 

if the piece is pulled by a chain to the right around a sprocket for example, only the right most pin will be hooked to the chain, the left most will be on a track to trail along around the curve?  Leftmost pin can't be pinned to the chain as the center distance will no remain the same as the chain link pin center distance's around the corner?

 

constraint the lead pin and calculate the angle of turn for an increment of travel, i.e. link length of the chain, around the corner.  the straight sections will be straight path arrays?

 

 

 

 

 

0 Likes
Message 8 of 13

Ranjit_Singh
Advisor
Advisor

I don't think multi-point constraint is available in AutoCAD. But since @john.vellek has not commented yet I maybe wrong. Meanwhile you could try the below routine. Routine generates copies of the object. Minimal testing done. see screencast on how it works. Give it a shot.

;:Ranjit Singh
;;5/22/2017
(defun c:somefunc  (/ adoc a d d1 f obj obj1 p1 p2 v)
(vla-startundomark (setq adoc (vla-get-activedocument (vlax-get-acad-object))))
 (setq obj  (vlax-ename->vla-object (car (entsel "\nSelect Path: ")))
       obj1 (car (entsel "\nSelect Object to follow along path: "))
       v    (mapcar 'getvar '(osmode cmdecho nomutt))
       p1   (getpoint "\nSelect constraint point 1: ")
       p2   (getpoint "\nSelect constraint point 2: ")
       d1   (getreal "\nEnter distance along path: ")
       d    (distance p1 p2)
       a    (angle p1 p2)
       f    (- (vlax-curve-getdistatparam obj (vlax-curve-getendparam obj)) d1))
 (mapcar 'setvar '(osmode cmdecho nomutt) '(0 0 1))
 (while (<= (vlax-curve-getdistatpoint obj p2) f)
  (command-s "._copy" obj1 "" p1 (setq p1 (vlax-curve-getclosestpointto obj
                                                  (vlax-curve-getpointatdist obj
                                                                             (+ d1 (vlax-curve-getdistatpoint obj (vlax-curve-getclosestpointto obj p1)))))))
  (command-s "._rotate" (setq obj1 (entlast)) "" p1 "_r" p1 (polar p1 a d) (setq p2 (somefunc2 obj p1 d))) (setq a (angle p1 p2)))
 (mapcar 'setvar '(osmode cmdecho nomutt) v)
 (vla-endundomark adoc))


(defun somefunc2  (a b c / ent rpt)
 (setq rpt (caar
            (vl-sort (vl-remove-if '(lambda (x) (minusp (cdr x)))
                                   (mapcar '(lambda (x) (cons x (- (vlax-curve-getparamatpoint a x) (vlax-curve-getparamatpoint a b))))
                                           (somefunc3
                                            (vlax-invoke a 'intersectwith (vlax-ename->vla-object (setq ent (entmakex (list '(0 . "circle") (cons 10 b) (cons 40 c))))) 0))))
                     '(lambda (x y) (< (cdr x) (cdr y))))))
 (entdel ent)
 rpt)


(defun somefunc3  (x)
 (cond ((null x) ())
       (t (cons (list (car x) (cadr x) (caddr x)) (somefunc3 (cdddr x))))))

Double_Constraint_Array.gif

Message 9 of 13

mcardonne
Community Visitor
Community Visitor

Thanks, I was looking for something like that for quite some time. 😀

0 Likes
Message 10 of 13

Sea-Haven
Mentor
Mentor

The forklift wide load. Just uses a simple get angle at point along a pline.

Fork lift.png

Nice code doing the twist in the array.

 

 

 

0 Likes
Message 11 of 13

huey_do
Community Visitor
Community Visitor

Hi All,

 

Great code. But lately, i've ran into it giving a "; error: bad argument type: 2D/3D point: nil".  Does anyone happen to know what could cause it? I checked all the Z points are on the same level. even did a dummy path and rectangle box to check.

0 Likes
Message 12 of 13

Sea-Haven
Mentor
Mentor

Here is another lisp needs a block called FORK and has two points set at 1.5, you can change in code.

; draw a vehicle along a path 
; By AlanH 
; block name is FORK has base at 0,0 
; and second point is set at 1.5 CRAD variable

(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" "Fork")
(princ "FOrk")
(progn
(command "-Insert" "fork.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 1.5) ; forklift wheel base
(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" "Fork" stpt 1 1 ang) ; need ang in radians

(setq stpt (vlax-curve-getpointatdist obj (setq dist (+ dist interval))))
(command "delay" 500)
;(command "erase" "l" "")
) ; repeat

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

(princ)
) ; defun

(draw_vehicle)
0 Likes
Message 13 of 13

navya_gelli
Autodesk
Autodesk

Hi @huey_do,

I wanted to check in and see if you still needed assistance, or if you found a solution to your question already? Let us know if you need further assistance by providing an update or if you have found a solution, please share it with the community so other members who may have the same question could learn from your experience.
 

Let us know how we did on Trustpilot.


Navya Gelli
Community Manager

0 Likes