Author Topic: How to get "extmin" and "extmax" from current UCS?  (Read 3273 times)

0 Members and 1 Guest are viewing this topic.

Peter2

  • Swamp Rat
  • Posts: 650
How to get "extmin" and "extmax" from current UCS?
« on: October 11, 2018, 09:47:38 AM »
As written above: How to get "extmin" and "extmax" from current UCS?

A simple "trans" of the sysvars (from WCS) does not do "enough" - there should be also a "scaling", depending on the angle between WCS and UCS?
Peter

AutoCAD Map 3D 2023 German (so some technical terms will be badly retranslated to English)
BricsCAD V23

Crank

  • Water Moccasin
  • Posts: 1503
Re: How to get "extmin" and "extmax" from current UCS?
« Reply #1 on: October 11, 2018, 01:08:04 PM »
Thinking out loud:
"Isn't this a orthogonal boundingbox of the (rotated) rectangle that's defined by the corners of EXTMIN and EXTMAX ?"
Vault Professional 2023     +     AEC Collection

Peter2

  • Swamp Rat
  • Posts: 650
Re: How to get "extmin" and "extmax" from current UCS?
« Reply #2 on: October 11, 2018, 01:57:46 PM »
Hi Crank

the problem (or maybe: my wrong thoughts) is: the proportion of the bounding box is changing.

Example:
- a line form 0,0 to 10,10 in WCS
- bounding box: length of x = 10, length of y = 10; diagonal = 14.1

Set of UCS, rotated 45°:
- a line form 0,0 to 0,10 in UCS
- bounding box: length of x = 0, length of y = 14.1

And "trans" on the two sysvars does not handle the entire modification.
Peter

AutoCAD Map 3D 2023 German (so some technical terms will be badly retranslated to English)
BricsCAD V23

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: How to get "extmin" and "extmax" from current UCS?
« Reply #3 on: October 11, 2018, 02:00:23 PM »
What Crank has explained is the approach to go for, although I would say you have to calculate a box around the boundingbox defined by EXTMIN and EXTMAX.

Calculate 8 points from EXTMIN and EXTMAX...
Translate them to the current UCS...
Determine the boundingbox around them (This translated box will in most cases be bigger).

A very similar approach is used by the CAD system to calculate the boundingbox of a rotated insert.

Peter2

  • Swamp Rat
  • Posts: 650
Re: How to get "extmin" and "extmax" from current UCS?
« Reply #4 on: October 16, 2018, 02:17:21 PM »
Here my current state (simple-minded assumption, under development):

- use WCS
- calculate and save extmin and extmax
- (draw the rectangle for better imagination)
- define rotated (round z-axe) and moved UCS
- use "plan" on the usc

- the rectangle shows: the corners are outside the "current extmin / max". They are "more or less near the extents", but no element is outside these pseudo-elements. And this is important for me
- use "trans" from WCS to UCS to calculate the 4 corners
- search min X/Y (for pseudo-extmin) and max X/Y (for pseudo-extmax)

As said above: It is outside the real extmin / extmax!

Peter

AutoCAD Map 3D 2023 German (so some technical terms will be badly retranslated to English)
BricsCAD V23

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: How to get "extmin" and "extmax" from current UCS?
« Reply #5 on: October 17, 2018, 03:49:57 AM »
The EXTMIN and EXTMAX are expressed in the WCS. So you do not need to switch to the WCS before using them.

For the rest I think your 2D procedure works along the same principles as my 3D procedure.

Getting the smallest, tightest, boundingbox in the current UCS is also possible. But it does require some work:
  • Copy all MS entities (perhaps to an anon block definition).
  • Apply a reversed transformation matrix to account for the UCS settings.
  • Get the boundingbox of each entity.
  • Calculate the overall boundingbox.

Peter2

  • Swamp Rat
  • Posts: 650
Re: How to get "extmin" and "extmax" from current UCS?
« Reply #6 on: October 18, 2018, 03:05:57 AM »
Another way could be the usage of the screen-data (alos a kind of "semi-solution":

- start "_zoom" extents
- use the sysvars viewctr, viewsize, screensize
example see here: https://ww3.cad.de/foren/ubb/Forum145/HTML/004606.shtml#000004

- Advantage: one dimension (width or height) is always exact
- disadvantage: the "trans" between WCS nd UCS has always to be considered.
Peter

AutoCAD Map 3D 2023 German (so some technical terms will be badly retranslated to English)
BricsCAD V23

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: How to get "extmin" and "extmax" from current UCS?
« Reply #7 on: October 18, 2018, 03:26:48 AM »
I have suggested that approach on the BricsCAD forum where you have posted the same question. But after testing I have found that the extents are bases on a boundingbox around the WCS boundingbox.

Peter2

  • Swamp Rat
  • Posts: 650
Re: How to get "extmin" and "extmax" from current UCS?
« Reply #8 on: October 18, 2018, 05:31:35 AM »
I have suggested that approach on the BricsCAD forum ...
Oops - sorry roy, just now I understand the "screenpoints" that you mentioned there.

For me, I'm satisfied with the current solutions. Not perfect, but helpful ..
Peter

AutoCAD Map 3D 2023 German (so some technical terms will be badly retranslated to English)
BricsCAD V23