The Hurricane Forum
The Hurricane Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 AutoCAD
 Lisp & Other Handy Files
 Find center of circle and move all objects
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Strobe
New Member



USA
8 Posts

Posted - March 27 2019 :  1:21:24 PM  Show Profile  Visit Strobe's Homepage  Reply with Quote
Hi guys. Long time user of Hurricane looking for help.

I get drawings (DWG files) exported from a 3D plant design software package called Aveva E3D. The DWG files are Mechanical GAs from E3D that we need to use as xref in AutoCAD. The coordinates between E3D and AutoCAD don’t align (they never have or will).

My task is to move all DWG objects to the correct coordinates in the exported DWG files so they can be used as xrefs by other disciplines. Revised files are exported nightly.

This is what I need to do:
• The DWGs contain a circle on a layer O-GRID-DIMS
• It’s the only circle or object on that layer
• Find the center of that circle (which is 0,0,0 in E3D)
• Move all objects from the center of that circle to coordinate 0,0,0

The end goal is to create a batch process requiring no user action that we can use on a daily basis to update these xrefs from the 3D plant design package. E3D DWG sample attached.

Any ideas or suggestions?

Download Attachment: GA_Test1.zip
52.31 KB

Strobe
New Member



USA
8 Posts

Posted - March 27 2019 :  1:40:08 PM  Show Profile  Visit Strobe's Homepage  Reply with Quote
I've figured out how to use SSX to select the circle and SSX to pick all objects but can't figure out how to pick the center of the circle for the MOVE command line. Will this require a lisp file?
Go to Top of Page

Strobe
New Member



USA
8 Posts

Posted - March 27 2019 :  4:38:36 PM  Show Profile  Visit Strobe's Homepage  Reply with Quote
A co-worker came up with the solution. Maybe it will help someone else. Here it is...

(defun c:amod (/ ss CenterPoint X Y StartPoint EndPoint)
(and
(setq ss (ssget "_x" '((0 . "circle")(8 . "O-GRID-DIMS"))))
(setq CenterPoint (cdr(assoc 10 (entget (ssname ss 0)))))
)
;(princ CenterPoint)
(setq X(car CenterPoint))
(setq Y(cadr CenterPoint))
(setq StartPoint(strcat (rtos X) "," (rtos Y) ",0.0000"))
(setq EndPoint "0.0000,0.0000,0.0000")
(command ".move" "all" "" StartPoint EndPoint "")
)
Go to Top of Page

Admin
Administrator



652 Posts

Posted - March 27 2019 :  5:56:43 PM  Show Profile  Visit Admin's Homepage  Reply with Quote
Awesome solution.

Thank you and your co-worker for sharing back.

Hurricane for AutoCAD
http://www.74mph.com
FAQ at
http://www.74mph.com/faq/faq.html
Tutorials at
http://www.74mph.com/tutorials.html
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Hurricane Forum © 2009 - 2021 Go To Top Of Page
This page was generated in 0.03 seconds. Snitz Forums 2000