Jump to content

Recommended Posts

Posted

Hi Expert,

we have some A3 sheets of drawings in an autocad file, which are located beside each other with different distance and space on X axis.

I need a lisp in a way that all those sheets could be beside each other on X axis with the same distance from each other. for example

10 mm for the space between of each.

Thanks

 

Posted

Providing they have say a Title block or pline on individual layer around each then no problem all in one go. If Not then again a bit slower as you use bounding box around each window select.

 

Have you thought about changing to layouts ? A much better way to work.

 

Post sample dwg.

Posted

Yeah, I know what you meant, I'm aware of title blocks and their order ,but the thing that I need is the same space of each in X axis.
Please find the attached file.

 

8-NG-001-F01-PT_Sht_1.dwg

Posted

As the dwg supplied is just all entities you would just window an area and move the objects to a new pt with a X spacing. If the title was a block much easier.

 

Again an option may be to use layouts.

 

Posted (edited)

Have you cut and pasted multiple dwgs into one ? That's why I am getting funny results, if your going to do this then paste into a layout so much better way to handle the final dwg. So they are blocks in the dwg ? You have exploded 1 to make life confusing.

 

Leave them as blocks no code required, when you paste just do so with points likes 0,0 0,500 0,1000 0,1500 make sure when you copy original pick base point lower left corner.

 

2nd method after 1 explode.

;; Selection Set Bounding Box  -  Lee Mac
;; Returns a list of the lower-left and upper-right WCS coordinates of a
;; rectangular frame bounding all objects in a supplied selection set.
;; sel - [sel] Selection set for which to return bounding box

(defun LM:ssboundingbox ( sel / idx llp ls1 ls2 obj urp )
    (repeat (setq idx (sslength sel))
        (setq obj (vlax-ename->vla-object (ssname sel (setq idx (1- idx)))))
        (if (and (vlax-method-applicable-p obj 'getboundingbox)
                 (not (vl-catch-all-error-p (vl-catch-all-apply 'vla-getboundingbox (list obj 'llp 'urp))))
            )
            (setq ls1 (cons (vlax-safearray->list llp) ls1)
                  ls2 (cons (vlax-safearray->list urp) ls2)
            )
        )
    )
    (if (and ls1 ls2)
        (mapcar '(lambda ( a b ) (apply 'mapcar (cons a b))) '(min max) (list ls1 ls2))
    )
)

(defun c:move-em2 ( / oldsnap pt pt2 pt3 xoff x yes)
(setq oldsnap (getvar 'osmode))
(setq pt (Getpoint "\nPick a point as base point"))
(setq xoff (getreal "\nEnter x offset "))
(setq Yes "")
(setvar 'osmode 0)
(while (= yes "")
(setq pt2 (getpoint "\nPick lower left corner "))
(setq pt3 (getpoint "\npick upper right corner "))
(command "zoom" "e")
(setq ss (ssget "W" pt3 pt2 (list (cons 0 "*line"))))
(setq cnrs (LM:ssboundingbox ss))
(setq pt2 (nth 0 cnrs))
(setq pt3 (nth 1 cnrs))
(setq x (- (car pt3)(car pt2 )))
(setq pt3 (mapcar '+ pt3  (list 1.0 1.0 0.0)))
(setq pt4 (mapcar '+ pt2 (list -1.0 -1.0 0.0)))
(setq ss (ssget "W" pt3 pt4 ))
(command "move" ss "" pt2 pt)
(setvar 'osmode 1)
(setq pt (mapcar '+ pt  (list (+ x xoff) 0.0 0.0)))
(setq Yes (getstring "\nPress Enter to continue any key to exit"))
)
(setvar 'osmode oldsnap)
(princ)
)
(c:move-em2)

 

Edited by BIGAL
Posted

Sorry for delay on response. Yes exactly, I need it .would you please help me with that? Thank you very much

Posted
4 hours ago, mehrdad said:

Sorry for delay on response. Yes exactly, I need it .would you please help me with that? Thank you very much

 

 

Here is the link to the program:  Revers
Video (how to use) in a previous post.

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