Rounding coordinates of line

Rounding coordinates of line

Anonymous
Not applicable
4,470 Views
13 Replies
Message 1 of 14

Rounding coordinates of line

Anonymous
Not applicable

Hello

I have a drawing where the X,Y coordinates of the lines are not rounded like (18.997,15.999) - (18.997,35.999).

is there any code or command that will move the lines and change the coordinates of the line to the nearest whole number? (19.000,16.000) - (19.000,36.000)

Thanks.

 

Accepted solutions (1)
4,471 Views
13 Replies
Replies (13)
Message 2 of 14

imadHabash
Mentor
Mentor

Hi.

i suggest from DDUNITS command to change the precision like  0.00  .

 

 

Imad Habash

EESignature

0 Likes
Message 3 of 14

Anonymous
Not applicable

Thanks but I am looking for something else.

I don't want to change the precision. the next step is to insert the drawing fro AutoCAD to final elements program, so the precision must be perfect. in the final elements program, 19.999 is 19.999, not 20.00.

 

 

0 Likes
Message 4 of 14

imadHabash
Mentor
Mentor

>> is there any code or command that will move the lines and change the coordinates of the line to the nearest whole          number? (19.000,16.000) - (19.000,36.000)

i understand here that you want to move your CAD elements to get zero precision .

>> so the precision must be perfect. in the final elements program, 19.999 is 19.999, not 20.00.

i missed here your point !!! did you want a perfect number or what ??

 

Any way ... if you want to get a real coordinates numbers with zero precision then you have to select all of your drawing elements and MOVE them to the right coordinate . on the other side if you change the precision from DDUNITS as i told you previously this is mean that your coordinates rounded to the nearest perfect number 19.00 , 16.00 ( as you asked ) BUT your elements still exist at  18.997 , 15.999   . 

 

 

 

 

Imad Habash

EESignature

0 Likes
Message 5 of 14

Moshe-A
Mentor
Mentor

@Anonymous  hi,

 

let's say there is a tool to do want you want don't you worrie that a straight lines would become diagonal and lines that are intersect would be left with gaps?

 

moshe

 

 

 

0 Likes
Message 6 of 14

Alfred.NESWADBA
Consultant
Consultant

Hi,

 

first at all you should verify why this happened. Because a tool that changes now the geometry might fail on some specific geometry points. So preventing this inaccuracy during construction is what you should look for.

 

A way out may help to save your geometry as DXF and in the dxf options set the number of decimal places to 3 or so, but take care, that means every point in the geometry (in your complete drawing) will be rounded. The alternative is to only export selected objects in the following dialog, then you have to erase the exported objects and import the ones you have exported to DXF).

 

Therefor start command _DXFOUT and in the dialog where you can specify the output filename you can chose Tools ==> Options

 

20190602_105521.png

 

20190602_105738.png

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2025
------------------------------------------------------------------------------------

(not an Autodesk consultant)
Message 7 of 14

vladimir_michl
Advisor
Advisor
Accepted solution

As I understand it, you need to "round" the geometry of the drawing (snap it to a virtual "grid"). Try the FixOffGrid utility by Joe Burke and set the appropriate grid size. You can find FixOffGrid here in the forum or on https://www.cadforum.cz/cadforum_en/qaID.asp?tip=6065

 

Vladimir Michl, www.cadstudio.cz - www.cadforum.cz

 

Message 8 of 14

Anonymous
Not applicable

YES !!   🙂

this is what I looked for

Vladimir, thank you very much

and thanks to everyone who helped 🙂

 

Message 9 of 14

Anonymous
Not applicable

In the program description is written:

;; The fuzz value determines the range of what's considered "off grid"
;; expressed as an integer which represents number of decimal places.
;; 6 equals 1e-6. Lower values will find fewer off grid objects.
;; Values above 8 will will identify off grid points/objects beyond the
;; precision which can be displayed in Properties.

 

But this fuzz value what is?

I try some decimal values 0.1 , 0.001 , 0.000001 but something sounds strange.

Smaller is the value higher is the range of fixing.

 

0 Likes
Message 10 of 14

vladimir_michl
Advisor
Advisor

One of the modifications available on CADforum.cz is about entering the *fuzz* value - you can do it in a standard way, specifying the requested precision - e.g. entering the value of 0.1 will "round" the geometry to a virtual grid of 0.1 unit squares (...0.9, 1.0, 1.1, 1.2...).

 

Vladimir Michl, www.cadstudio.cz - www.cadforum.cz

 

0 Likes
Message 11 of 14

Kent1Cooper
Consultant
Consultant

For additional approaches, do a Search for "QUANTIZE" -- >here< are results in the AutoCAD Forums [including this one and the Customization Forum].

Kent Cooper, AIA
0 Likes
Message 12 of 14

Anonymous
Not applicable

Dear Vladimir,

In the fixoffgrid you mention in your website the text in the script is the same.

If you open the file with Notepad you can read the same text.

The point is if I use the "fxg" command with parameters 1; 0.01 I expect that around the each point of the grid  a square with the side 0.02 with the center of the square the grid point. Each line with the end inside the square will be moved to the grid vertex. This is not happening.

 

0 Likes
Message 13 of 14

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

.... if I use the "fxg" command with parameters 1; 0.01 I expect that around the each point of the grid  a square with the side 0.02 with the center of the square the grid point. Each line with the end inside the square will be moved to the grid vertex. This is not happening.


Can you illustrate with an image or sample drawing?  What is  happening?  Show before and after.

 

If I understand your description correctly, and the description in the routine's comments, I think you should be giving it 2 for the fuzz factor, for 2 decimal places, not 0.01, to get the "virtual square" defining what's off-grid to be 0.01 around the grid point.  But saying that "off grid" means not within 2 decimal places means anything inside that virtual square would be considered not  off-grid by far enough to bother moving it to the grid point.  I suspect you want a higher fuzz value, to move things that are off by far less.

 

If you want something without  that fuzz thing, that will move everything to the closest grid point without  the possibility of things being left where they are because they're "close enough," look at some of the things in my linked Search.  One of mine [with several defined commands] is in zzQuantize.lsp, available >>here<< -- see the comments there and in the file.

Kent Cooper, AIA
0 Likes
Message 14 of 14

Anonymous
Not applicable

Dear Kent,

zzQUANTIZE seems to be what I need. Command QSS.

 

I may need to 0.2 or 0.3 or 0.15 because some piping has decimal diameter, so if I round to 1 I loose the real pipe diameter.

Example 48.3 mm (1" 1/2) cannot become 48.0 mm.

 

Anyhow I tried to generate lines with one end to coordinates 1.01, 1.01 and apply FixOffGrid

- grid value: 1, fuzz: 2 => nothing happen

- grid value: 1, fuzz: 1 => nothing happen

- grid value: 1, fuzz: 0.1 => nothing happen 

- grid value: 1, fuzz: 0.01 => fixed to 1 ,1

- grid value: 1, fuzz: 0.001 => fixed to 1 ,1

 is not working properly with a kind of logic on the fuzz parameter. It seems that rounds what is coincident or outside the "virtual square". And is not what I need.

 

I will use zzQUANTIZE from now on.

Many thanks.

0 Likes