Jump to content

Moving and align objects at same distance - putting house in order.


Recommended Posts

Posted

Noop ReMark... I have many ways to do what I whant, so, sometimes I need to regroup the objects created (lines in this case)... because it I posted the new question...

  • Replies 28
  • Created
  • Last Reply

Top Posters In This Topic

  • CafeJr

    13

  • ReMark

    8

  • Dana W

    4

  • pBe

    2

Top Posters In This Topic

Posted Images

Posted
(Defun c:alg (/ spep ss lcoll frx refe rf pt npt)
 (defun spep (e / e y1 y2)
   (setq y1 (vlax-curve-getStartPoint e)
  y2 (vlax-curve-getEndPoint e)
   )
   (append (list e)
    (if	(minusp (- (cadr y1) (cadr y2)))
      (list y2 y1)
      (list y1 y2)
    )
   )
 )
 (if (setq lcoll nil
    ss	     (ssget '((0 . "LINE,LWPOLYLINE")))
     )
   (progn
     (setq lcoll (cons (spep (setq e (ssname ss 0)))
		   lcoll
	     )
    Frx	     (caadar lcoll)
    refe     e
     )
     (ssdel (caar lcoll) ss)
     (repeat (setq i (sslength ss))
(setq
  lcoll (cons (spep (setq e (ssname ss (setq i (1- i)))))
		 lcoll
	   )
)
(if (< (setq rf (caadar lcoll)) Frx)
  (setq	Frx  rf
	refe (caar lcoll)
  )
)
     )
     (setq ds (getdist	(setq pt (cadr (Spep refe)))
		"\nSpecify Distance from this point:"
       )
     )
     (setq lcoll (vl-remove (assoc refe lcoll) lcoll))
     (foreach itm (vl-sort (mapcar 'reverse lcoll)
		    '(lambda (j k) (< (caar j) (caar k)))
	   )
(vla-move (vlax-ename->vla-object (last itm))
	  (vlax-3d-point (Cadr itm))
	  (vlax-3d-point (setq npt (polar pt 0.0 ds)))
)
(setq pt npt)
     )
   )
 )(princ)
)(vl-load-com)

Posted

This is why I usually just draw the stuff I need. By the time resources for short cuts are found, the deadline or my patience, or both is exhausted.

Posted

Well you failed to tell us what kind of drawings you create so I don't know if this is something you need to do for every job or if it is a one shot deal.

Posted
Well you failed to tell us what kind of drawings you create so I don't know if this is something you need to do for every job or if it is a one shot deal.

 

ReMark... Sorry, I didn't tryed explain!...

 

I wrote it twice today using mobile phone, so I don't know why it don't filled up on post!!!... Well, let me try again!... I'm working with some guys that don't know the features of AutoCad or AutoLisp... As an exemple, they use the command offset on 150 entities, but, one by one!!!... It's so cool to do it!!!... I got one code that could help them with it, doing it for all selected item as fast as system allows (cad or windows)!!!... Usually they receive from other some drawings that have a lot of objects (arcs, plines, lines) in disorder, it need to be ordened to be possible start to work... like in this case!!!... We get a mechanical drawing (circular objects - helice of wind power system) that need to be exchanged this drawing in a plan way (geting the perimeter from a circunference and drawing it as a line)... It's possible create a lot of small commands or funcions that could help us... I think that I explained!... affffff... He he he...

Posted
This is why I usually just draw the stuff I need. By the time resources for short cuts are found, the deadline or my patience, or both is exhausted.

 

Yeahhh Dana W, I know it!... Sorry, as I told you, I didn't pay attention on my drawing, only about the issue!!!...

Posted

Did you even look at the link I posted to Lee Mac's Dynamic Offset lisp program? Yes or no?

Posted
(Defun c:alg (/ spep ss lcoll frx refe rf pt npt)
 (defun spep (e / e y1 y2)
   (setq y1 (vlax-curve-getStartPoint e)
 y2 (vlax-curve-getEndPoint e)
   )
   (append (list e)
   (if(minusp (- (cadr y1) (cadr y2)))
     (list y2 y1)
     (list y1 y2)
   )
   )
 )
 (if (setq lcoll nil
   ss     (ssget '((0 . "LINE,LWPOLYLINE")))
     )
   (progn
     (setq lcoll (cons (spep (setq e (ssname ss 0)))
  lcoll
    )
   Frx     (caadar lcoll)
   refe     e
     )
     (ssdel (caar lcoll) ss)
     (repeat (setq i (sslength ss))
(setq
 lcoll (cons (spep (setq e (ssname ss (setq i (1- i)))))
lcoll
  )
)
(if (< (setq rf (caadar lcoll)) Frx)
 (setqFrx  rf
refe (caar lcoll)
 )
)
     )
     (setq ds (getdist(setq pt (cadr (Spep refe)))
"\nSpecify Distance from this point:"
      )
     )
     (setq lcoll (vl-remove (assoc refe lcoll) lcoll))
     (foreach itm (vl-sort (mapcar 'reverse lcoll)
   '(lambda (j k) (< (caar j) (caar k)))
  )
(vla-move (vlax-ename->vla-object (last itm))
 (vlax-3d-point (Cadr itm))
 (vlax-3d-point (setq npt (polar pt 0.0 ds)))
)
(setq pt npt)
     )
   )
 )(princ)
)(vl-load-com)

 

pBe thaks again, it will help me!... And works perfectly!...

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