Author Topic: Matrix3d and TransformBy help  (Read 56325 times)

0 Members and 1 Guest are viewing this topic.

Spike Wilbury

  • Guest
Re: Matrix3d and TransformBy help
« Reply #90 on: August 08, 2008, 07:06:48 PM »
No prob's, after posting the first one I realised that the measured edge was the longest edge even though the depth of the beam was greater. The thing is, when looping through the edges it won't get the height, only the length of the beam web edge which is well short of the length, that's why I posted the second one ;)


This is what I am getting:

MickD

  • King Gator
  • Posts: 3636
  • (x-in)->[process]->(y-out) ... simples!
Re: Matrix3d and TransformBy help
« Reply #91 on: August 08, 2008, 07:11:28 PM »
That looks pretty good to me Luis, 2 thumbs up!  :kewl:

heh, just noticed my dim was in the wrong place  :roll:
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.”
- J.R.R. Tolkien

Spike Wilbury

  • Guest
Re: Matrix3d and TransformBy help
« Reply #92 on: August 08, 2008, 07:13:07 PM »
That looks pretty good to me Luis, 2 thumbs up!  :kewl:

heh, just noticed my dim was in the wrong place  :roll:

:)

MickD

  • King Gator
  • Posts: 3636
  • (x-in)->[process]->(y-out) ... simples!
Re: Matrix3d and TransformBy help
« Reply #93 on: August 08, 2008, 07:35:11 PM »
Hang on Luis, you're not off the hook yet :)

I just realised that both samples were in the world ucs, just doing a 'list' would've given the correct BB,
try the one attached, it has a couple of rotations added :)
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.”
- J.R.R. Tolkien

Spike Wilbury

  • Guest
Re: Matrix3d and TransformBy help
« Reply #94 on: August 08, 2008, 10:50:46 PM »
Hang on Luis, you're not off the hook yet :)

I just realised that both samples were in the world ucs, just doing a 'list' would've given the correct BB,
try the one attached, it has a couple of rotations added :)

Have a look:
« Last Edit: August 08, 2008, 11:09:54 PM by LE »

MickD

  • King Gator
  • Posts: 3636
  • (x-in)->[process]->(y-out) ... simples!
Re: Matrix3d and TransformBy help
« Reply #95 on: August 09, 2008, 02:07:31 AM »
Very nice!

Ok. now it beg's the question, what are you basing your direction/s on? One thing I do notice off the top of my head is that the majority of edges point in the same direction, this would work with this kind of solid at least.

So, can you get the BB regardless of the current UCS and the rotation of the solid? If so, this is a great feat Luis, nice work!
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.”
- J.R.R. Tolkien

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8702
  • AKA Daniel
Re: Matrix3d and TransformBy help
« Reply #96 on: August 09, 2008, 09:53:36 AM »
Nice work, my routine did not get this one. What’s your secret 

Spike Wilbury

  • Guest
Re: Matrix3d and TransformBy help
« Reply #97 on: August 09, 2008, 10:16:34 AM »
Ok. now it beg's the question, what are you basing your direction/s on? One thing I do notice off the top of my head is that the majority of edges point in the same direction, this would work with this kind of solid at least.

I think it will required more tests and with more complex solids, and included those with rounded edges, etc.

Quote
So, can you get the BB regardless of the current UCS and the rotation of the solid? If so, this is a great feat Luis, nice work!

Per all the tests so far, looks like it does/will.

Zydenet

  • Guest
Re: Matrix3d and TransformBy help
« Reply #98 on: August 12, 2008, 09:54:44 AM »
I've been following this discussion with a good bit of interest since Luis pointed it to me from another group. I too have been playing around with this but using acis data and reading the sat file. Boxes where easy to read from the sat file but I could never figure out a way to consistently read a cylindrical object. Reading pipe runs to create a BOM was what I was after. I tried your BrepTest on a cylinder and it seems to pick it up correctly as long as it's 90%%d to the wcs. The problem is when you rotate it (with the sat file). It's hard to pick up the center (points) of each circular face to get an accurate length. Gave up on this about a year ago. Just something I thought I would kick out to ya'll to see if there was a way with the path that you're going.

Spike Wilbury

  • Guest
Re: Matrix3d and TransformBy help
« Reply #99 on: August 12, 2008, 11:42:14 AM »
OK....

So, everyone that have participated here, it is going to their own directions/approach/etc, no?

How about, to take a single one? - it won't matter if it going to be open or close source code.

Also, can this topic be moved to the C++ forum?


Maybe?


It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8702
  • AKA Daniel
Re: Matrix3d and TransformBy help
« Reply #100 on: August 12, 2008, 11:52:22 AM »
I've been following this discussion with a good bit of interest since Luis pointed it to me from another group. I too have been playing around with this but using acis data and reading the sat file. Boxes where easy to read from the sat file but I could never figure out a way to consistently read a cylindrical object. Reading pipe runs to create a BOM was what I was after. I tried your BrepTest on a cylinder and it seems to pick it up correctly as long as it's 90%%d to the wcs. The problem is when you rotate it (with the sat file). It's hard to pick up the center (points) of each circular face to get an accurate length. Gave up on this about a year ago. Just something I thought I would kick out to ya'll to see if there was a way with the path that you're going.


Welcome to the thread  :lol:
I wouldn’t expect my routing to work with anything but cuboid type solids. A normal cylinder ought to be fairly simple as there are only two points, you could either calculate the distance between the two points or use the two points to find the direction (to get a bounding box). The difficulties begin when the solid are more complex I.e. curved pipe.

BTY, have you tried Sean’s routine here in this thread
http://www.theswamp.org/index.php?topic=24045.msg291577#msg291577

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8702
  • AKA Daniel
Re: Matrix3d and TransformBy help
« Reply #101 on: August 12, 2008, 11:57:48 AM »
Also, can this topic be moved to the C++ forum?

We can start a new thread in the C++ area.
                  Just so everyone is aware, solutions in any language would be welcome.

MickD

  • King Gator
  • Posts: 3636
  • (x-in)->[process]->(y-out) ... simples!
Re: Matrix3d and TransformBy help
« Reply #102 on: August 12, 2008, 04:50:53 PM »
The problem sounds simple - get the aligned bounding box of arbitrary 3d solids to get there length (minimum, for extruded
sections say), width and height.
The theory is easy, get the direction/s of the solid, transform it to world, get the bbox and calc the LWH, then transform it back.

There's a catch though that I've yet to see a real solution too - how do you determine these directions accurately (i.e. the 'expected' xyz vectors of the solid) 'without' user interaction. The goal is to be able to iterate the drg and grab the LWH of all solids regardless of orientation to the WCS.
It can't be done with math as it fails, the parameters can change even in the same solid if someone adds another cut or similar modification.

This leaves only 2 options.

1) get the best case bounding box using math and hope it's alright, the only way to make sure it's correct is to present it to the user to decide which way is LWH (this is what MillLister does).

2) add at least one vector (for lengths only if that's all that's required) to the 3d solid at creation time. The best solution I find is to add world point xdata elements, these get transformed with the objects when copied and modified so they're pretty safe.

There's a couple of ways to do this, one would be to trap the extrusion event with a reactor and set the data relative to the current ucs. This only works if the solid's 'section' to extrude is aligned correctly to the ucs at the time though.

The other option is to create the xyz vec's in your code, the user needs to use your tools to create objects, not so bad really considering the benefits of other section data that can also be added.

Another option I thought of was creating a block lib of sections for extrusion, these polylines can have this data already attached which can be transfered to the solid using a home built 'extrusion' method or reactors. As they can be inserted at any angle the xdata is always updated.

Anyway, good luck, it's a good exercise in 3d math that's for sure!
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.”
- J.R.R. Tolkien

mohnston

  • Bull Frog
  • Posts: 305
  • CAD Programmer
Re: Matrix3d and TransformBy help
« Reply #103 on: August 13, 2008, 05:22:45 PM »
This is all way over my head but I'm interested anyway.
I happened to stumble on a webcast on the "brep" subject and I thought I would pass the link along.
http://download.autodesk.com/media/adn/ACADBrep.NETAPIWebcast_24Jun08.zip

I haven't watched the webcast, mostly because I don't even know who/what "brep" is/means and why I would want to use/ignore/master/understand/kick it.
It's amazing what you can do when you don't know what you can't do.
CAD Programming Solutions

MickD

  • King Gator
  • Posts: 3636
  • (x-in)->[process]->(y-out) ... simples!
Re: Matrix3d and TransformBy help
« Reply #104 on: August 13, 2008, 05:30:45 PM »
brep stands for 'boundary representation' and it's a library for traversing 3d solid manifolds to give you access to the vertice, edge and face data of an autocad 3d solid. You might use for highlighting a picked face or edge by the user to use for some other calcuation or part of your code.

vertices are 3d point coord's
edges are lines which contain 2 vertices and have a direction
faces have edges and a normal which dictates which way the face is pointing, generally to the outside of the solid (think of holes as a special case).
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.”
- J.R.R. Tolkien