TheSwamp

Code Red => VB(A) => Topic started by: SEANT on February 21, 2008, 05:20:32 AM

Title: Length of Solids revisited
Post by: SEANT on February 21, 2008, 05:20:32 AM
Here is a routine that employs some of the concepts described in these threads:

http://www.theswamp.org/index.php?topic=16754.0
http://www.theswamp.org/index.php?topic=20389.0

This routine does a reasonably good job measuring the lengths of arbitrarily aligned extruded solids.  An original orientation via ‘PrincipalDirection’ is refined with the generation of parallel section (virtual CAT scan) and centroid comparison.  This refinement is useful when querying extrusions with additional Booleans and/or slices -particularly at the ends.

There is also an attempt at Section recognition included within the routine.  If a “library” of Sections is pre-processed, the main routine will compare a 3D Solid section to this library and hopefully find a match.

The attached DWG includes some tagged sections (XData) and solids based on those sections.   To include a new section (as a Region entity), run the “SetRegData” routine.

This routine makes a few assumptions about the solid (specifically in the “Reorient” and “GenSection” subs).  Unfortunately, there seems to be a direct relationship between high confidence and time of execution.  The current level is a good trade off for my style of CAD work, though may be insufficient for more exacting design issues. 

Any suggestions to modify, eliminate, or reduce the quantity of these assumptions would be greatly appreciated.

Note: Code requires a reference to the appropriate Autocad/ObjectDBX library via VBAIDE-Tools-References
Title: Re: Length of Solids revisited
Post by: SEANT on February 24, 2008, 07:09:43 AM
Damn, this is a tough crowd! 

Certainly a crowd not readily impressed by unsolicited, Newt posted code structured to run on a 4 year old platform. :|
Title: Re: Length of Solids revisited
Post by: MP on February 24, 2008, 08:32:30 AM
You may find that you post something here and not a peep will be made. A year goes by, maybe more and then the post is discovered and the gem it contains illuminated and high fives anted up. But it's not because "it's a tough crowd". Ignoring the issue of the shear volume of information posted to the swamp ... it's a busy, preoccupied, self absorbed crowd, because that's the nature of our careers and and vocations. It's also what programming specifically demands: focus and undivided attention. It's nothing against you, it's just the way it is.

So be patient, be content. Know that you've contributed something good, something valuable to the swamp encyclopedia, and are now part of this great collective body of work.

Subtitle: Work hard, the rewards always come (though not necessarily when, or in the form one anticipates).

:)
Title: Re: Length of Solids revisited
Post by: SEANT on February 24, 2008, 09:33:43 AM
Point taken . . . . and appreciated. :-)
Title: Re: Length of Solids revisited
Post by: MP on February 24, 2008, 10:37:07 AM
Truly my pleasure, co-author Sean.

:)

(http://www.theswamp.org/screens/mp/highfive.png)
Title: Re: Length of Solids revisited
Post by: SEANT on February 24, 2008, 11:07:14 AM
Certainly a cool "high five". :lmao:
Title: Re: Length of Solids revisited
Post by: Bryco on February 25, 2008, 11:12:49 PM
I've just given this a run, my computer at home has been acting up and I crashed on ("ObjectDBX.AxDbDocument.16") (17 for me).
Anyway it's very impressive, when I get a bit more time I'll try to figure out how you did it.
Title: Re: Length of Solids revisited
Post by: SEANT on February 26, 2008, 06:02:05 AM
The attached module has several bug fixes.   A quick note, if the .bas extension is changed to .txt, it will allow a peek without requiring placement within a dvb.

I’ve also rearranged the subs to keep the most pertinent (i.e., non generic) ones towards the top, in the general order in which they are called.

The crux of the routine comprises the areas that make the most assumptions; ReOrient, Roll, and GenSection.  The parameters of these routines may require modification based on different industries.

With Autocad Mechanical, the Trans Matrix stuff would typically be handled by the GEAuto dll.  I suppose if my goal is to share, I’ll follow your’s (Bryco) and MickD’s lead and include that within the bas - once I get it all sorted out. 
Title: Re: Length of Solids revisited
Post by: MickD on February 26, 2008, 04:00:19 PM
Yes Sean, as MP said, it's definitely not that we're not interested there isn't more involvement here.

I'd like to comment but I haven't had time to scratch myself lately, I'm sure it's top notch though from what I've seen of your previous works ;)
Title: Re: Length of Solids revisited
Post by: SEANT on February 27, 2008, 03:53:21 AM
Thanks for the vote of confidence Mick.  It means a lot. 

P.S.  There are certain things that shouldn’t be left to chance.  You should really make plans to scratch. :-)