CAD Forum - Database of tips, tricks and utilities for AutoCAD, Inventor and other Autodesk products [www.cadforum.cz]
CZ | EN | DE
Login or
registration
  Visitors: 5919
RSS channel - CAD tips RSS tips
RSS discussions

Discussion Discussion forum

 

HelpCAD discussion

 
CAD Forum - Homepage CAD discussion forum - ask any CAD-related questions here, share your CAD knowledge on AutoCAD, Inventor, Revit and other Autodesk software with your peers from all over the world. To start a new topic, choose an appropriate forum.

Please abide by the rules of this forum.

How to post questions: register or login, go to the specific forum and click the NEW TOPIC button.
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Topic ClosedDrawing in relation to 0,0

 Post Reply Post Reply
Author
aarevalo0827 View Drop Down
Newbie
Newbie


Joined: 20.Jul.2017
Location: United States
Using: AutoCAD2015, AutoCAD Architecture 2016, REVIT 2012
Status: Offline
Points: 3
Direct Link To This Post Topic: Drawing in relation to 0,0
    Posted: 20.Jul.2017 at 21:29
So, we have over 5,000 blocks. These blocks all have different insertion points. What we are trying to do is find where the actual lines, arcs and circles within the drawing are located in relation to 0,0. I know we can do the list command and select the icons and it will give me a center point. I was wondering if there was a way to do it via a lisp command to make it faster. 
The reason for this is programming. We have a program that will pull these icons in and scale them. We just need to ensure they are placed correctly.
Back to Top
Kent Cooper View Drop Down
Senior Member
Senior Member


Joined: 12.Mar.2013
Location: United States
Using: AutoCAD2020, 2023
Status: Offline
Points: 627
Direct Link To This Post Posted: 21.Jul.2017 at 03:33
I'm having a hard time understanding exactly what you're asking.  5,000 Block definitions as files outside any working drawing, or 5,000 Block insertions within a drawing?  By "the actual lines, arcs and circles" do you mean those that make up the Blocks, or those that are not parts of Blocks, but that Blocks will be "pull[ed] in" and placed in relation to, somehow?  Are those 5,000 Blocks the same things as the "icons" you refer to, or are those something else?  Is the "center point" of an icon [if that's a Block] always its insertion point?

Probably what you are asking can be done -- I just don't quite get what that is, yet.  A sample drawing with notations, or even an image of some kind, would go a long way.
Back to Top
aarevalo0827 View Drop Down
Newbie
Newbie


Joined: 20.Jul.2017
Location: United States
Using: AutoCAD2015, AutoCAD Architecture 2016, REVIT 2012
Status: Offline
Points: 3
Direct Link To This Post Posted: 21.Jul.2017 at 14:16
Sorry for the confusion. The 5000 blocks are individual drawings/icons that are brought or inserted into other AutoCAD files. These 5000 blocks are made up of a group of lines, arcs and circles. Let's say one of the blocks is a stop sign. Instead of the center of the stop sign being the insertion point, it's insertion point is 0,0. The groupings of the stop sign (octogon and text) are located 20,50 (center of the stop sign). I want to know if there is a way for AutoCAD to tell me that the center of the stop sign is 20,50. I know that if I open the file and use the list command and select the groupings of the stop sign it will display the center location - 20,50. Is there a faster way of doing it for all of these drawings/icons? I hope I clarified my situation better. 
Thanks,
Back to Top
Kent Cooper View Drop Down
Senior Member
Senior Member


Joined: 12.Mar.2013
Location: United States
Using: AutoCAD2020, 2023
Status: Offline
Points: 627
Direct Link To This Post Posted: 21.Jul.2017 at 16:57
I don't know of a way to do that without Inserting one into a drawing, but once you've Inserted one, you can.  It involves getting the Block definition as an object with something like [if your Stop Sign is called "StopSign"]:
 
(setq ent (tblobjname "block" "StopSign"))
 
and then stepping through the things that make it up, which are the next entity, and the next, etc.:
 
(setq ent (entnext ent))
 
At each step, you can get entity data about the piece you're up to, and handle it any way you like.  The key is that those entities that make up the Block are all defined in terms of locational information in relation to the Block's defined insertion point.  So, if the word "STOP" in your Stop Sign is middle-justified at the center of the sign, and the Block's insertion point is 0,0, you could step through and check each entity for whether it's Text [on the assumption that there won't be any other Text object(s) in a Stop Sign Block], and if it is, get its insertion point, which in your example will be that 20,50 location, and stop looking further.  Similarly, if something is round, and doesn't have any Circles in it other than its outline, you could look at the pieces until you find a Circle, and get its center.
 
In Blocks that don't have some specific entity from which the middle location can be pulled like that, you could step through things and get their bounding boxes, keeping tabs on the lower left and upper right corner of each and saving the extremes, then find the midpoint between the outermost extents of all the objects.  [That does have the possibility of incorrect results in some circumstances, since some objects' bounding boxes can at least sometimes extend beyond their actual graphic extent -- Splines and Mtext are examples, and there might be others.]
Back to Top

Related CAD tips:


 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 0,460 seconds.