Jump to content

Geometric Center not working when objects are far away from 0,0,0


Recommended Posts

Hello guys

I am typing this because i am out of ideas

 

The problem we are having at the office is that when we try to use the geometric center with closed simple polygons, the geometric center is not quite in the center. Even with really simple polygons.

 

I found online that the problem could be some imported elements from other programs (like archicad or arcgis or something like that) , and that if you move your elements near the 0,0,0 coordinate point, the problem is solved. BUT, as you guessed, we can not do that since we work with real coordinates and we need them exactly referenced (the coordinates).

 

The weird thing is that, the "infected" files we have (the ones where the geometric center does not work) infect new files even if we copy a line or a polygon or anything at all.

Another thing is that it only happens in autocad architecture (2017), we have autocad civil 2016 and the problem does not happen there

 

I am attaching some files with the problem

GC1.jpg

GC2.jpg

GC3.jpg

EXAMPLE-GEOMETRIC CENTER.dwg

Link to comment
Share on other sites

thanks rkmcswain but i already read all of that.

In that link the problem is not even solved (even if it is marked as solved)

They came up with a solution which i said in my post (moving objects nearer the 0,0,0 point). The OP of that link at the end says that "that solution" does not work for him, (the same as me)

Link to comment
Share on other sites

Have you tried redefining your UCS so that the objects are close to the origin but have the proper coordinates? I've worked with state plane coordinates before, and that seems to help with this kind of issue.

 

Of course, this doesn't explain the "infection" issue. That points to something else.

 

Edit: I assume you tried AUDIT and RECOVER and antivirus scanning and all that. So it could be a bug.

Edited by CyberAngel
Link to comment
Share on other sites

yes CyberAngel. i already tried that.

I am starting to think that there is a problem with the geometric center and polygons with arcs as segments in our version of autocad. I will try to use the same files with other versions of autocad as soon as i can.

 

What really bothers me is that we did not have that problem before. There was a point in time where one by one my colleages starting having it in their files.

Edited by xxfaxx
more informaton
Link to comment
Share on other sites

If you have not already, send that DWG file to Autodesk with your Support Case request. There is something wrong for sure. It's not just the large coordinates.

I purposely created some polygons at locations where the X and Y were in the hundreds of millions and I cannot get it to give me an incorrect gcen osnap point.

 

I found a couple of your closed polylines where the gcen osnap was incorrect, and noticed that if I moved them slightly, the incorrect osnap point moved also, to a new incorrect location.

Link to comment
Share on other sites

Slightly modified version of a Lee Mac routine:

;Center of closed polygon
;^P(or C:pc1 (load "pc1.lsp"))(pc1)
; (load "pc1.lsp")(pc1)
(defun pc1 ( / acdoc acspc acsel reg pt) (vl-load-com) ;; © Lee Mac 2011

 (setq acdoc (vla-get-ActiveDocument (vlax-get-acad-object))
       acspc (vlax-get-property acdoc (if (= 1 (getvar 'CVPORT)) 'Paperspace 'Modelspace))
 )
;  (if (ssget "+.:E:S")
 (if (ssget "+.:E:S" '((0 . "LWPOLYLINE") (-4 . "&=") (70 . 1)))
   (progn
     (vlax-for obj (setq acsel (vla-get-ActiveSelectionSet acdoc))
       (setq pt(trans (vlax-get (setq reg (car (vlax-invoke acspc 'addregion (list obj)))) 'Centroid) 1 0))
       (vla-delete reg)
     )
     (vla-delete acsel)
   )
 )
 pt
)

Added macro to Object Snap Cursor Menu years before Geometric Center was added.

Command Name: Snap, Centroid

Description: Snap to Centroid of closed Polyline

Macro: ^P(or C:pc1 (load "pc1.lsp"))(pc1)

 

It might work for you as a workaround.

Link to comment
Share on other sites

Audit and recover did not work neither. It is definitely a bug

Thanks for the lisp tombu, but we already use an add-in called "arkitool" that has been helping us for years. We used it before autocad 2016 when we had no geometric center osnap.

Edited by xxfaxx
Link to comment
Share on other sites

Just a wild shot, but as with the hatching problem far away from the 0,0,0 origin, if you change the "SNAPBASE" to something near your desired entity do you get the desired results? Not having the referenced program release, cannot try it.

Link to comment
Share on other sites

I tried the old SNAPBASE trick and still no luck. The problem with hatches affects a lot of people and AFAIK Autodesk has not bothered to fix it, this bug seems to affect a lot less people, I doubt if Autodesk will bother with it.

 

I would move everything a set distance closer to 0,0 use the Geometric Center and place something there an move it back or better yet, see if there is a LISP out there to locate the Geometric Center.

Link to comment
Share on other sites

The following seems to work!

Save the dwg file as a dxf file (2010 or later) then open the dxf file and the geometric center object snap seems to be fine!

 

Lee

Link to comment
Share on other sites

Hey guys

Snapbase did not work neither.

The dxf trick did not quite make it. When i save it in dxf (at least it happens to me) only some polygons get their geometric center fixed. It is weird.

Moving objects is not a solution for us because that could lead to more unwanted problems (we are 13 people and some do not really know how to fully use autocad, i mean, i know moving objects is not a big deal, but we use thousands of dimensions, and when people move objects they move dimensions too, by mistake ofcourse, and that is a big deal for us)

We use an add-in that helps us get the geometric center. It is a little slower but it gets the work done.

Link to comment
Share on other sites

I think I am getting closer. Try the following:

Select all geometry and move with a displacement of -460000,-8060000. The will place the geometry closer to the origin.

Now save the file as a dwg.

Open a new drawing and insert the saved drawing at 460000,8060000 and DO NOT EXPLODE. The geometric center snaps appears to be correct for all the shapes. However, if you explode the geometry changing it from a block to polylines, geometric center snap doesn't work at all. Go figure?

 

Lee

Link to comment
Share on other sites

yeah that seemed to work.

Well kind of at least.

Making a block out of all our polygons is a good solution, and the geometric centers are correct as long as the polygons are a single (or multiple) block.

 

I just told a colleage this possible solution and she seemed to like it. It is easy and fast and it does not give us any possibility of making any further mistakes in the drawing.

 

I did not move anything or insert anything to any drawing. I just converted the polygons to a single block (with its base point in the middle of the group of polygons) and voila! it is fixed (kind of)

 

Thanks Irm, i couldn´t have thought of it alone

Link to comment
Share on other sites

Glad to hear that has some potential as a solution for you.

 

I am coming to the conclusion the problem might be a limitation of the video board precision. AutoCAD has a 64 bit database (56 bit mantissa) or about 16 significant figures. More than enough precision to handle your geometry. If the video board uses single precision floating point math it would be limited to 32 bits (24 bit mantissa) or about 7 significant figures. This would cause some rounding for geometry positioned as you have at about 8,000,000 in y. The error of the geometric center is consistent with the magnitude. The speed at which the geometric center is determined leads me to believe the calculation is done in the video board working on a display list of less precision than the AutoCAD database. By leaving the geometry as a block the coordinates used are offset from the blocks insertion point and then the offset is added.

Link to comment
Share on other sites

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