Author Topic: Thinking about flatten...  (Read 15656 times)

0 Members and 1 Guest are viewing this topic.

Joe Burke

  • Guest
Thinking about flatten...
« on: October 16, 2006, 01:00:52 PM »
Recently a client sent a drawing which needed flattening. I'm aware of the ET
flatten command and Mark Middlebrook's lisp routine named the same.

Niether one did the trick given the example drawing attached.

Mark's routine is limited in scope the sense it only deals with a limited set
of object types. And it does not deal with objects drawn outside of the WCS XY plane.
IOW, it simply resets certain Z coordinate values to zero. That's OK if that's
all that's needed.

Moving on to ET flatten. It attemps to flatten objects which are not parallel to
the WCS XY plane. Good idea I suppose, but the methods used seem questionable in
some cases. For instance, WMF out and back in are used. Look at the ET
flattensup.lsp file.

Futhermore, when I ran ET flatten on the example file it blew away the xrefs which
were not available. This was not evident until the file was saved, closed and reopened.
Obviously there's no reason it should do this.

I've also seen numerous errors like this:

Remove hidden lines? <No>:
bad argument type: lselsetp nil

Obviously an indication of poor programming.

So given all this I've been working on an alternative. But I'm very undecided about
what to do with objects drawn out of plane with WCS. Should they be projected to
the WCS plane? Or should they be translated intact to the WCS plane?

All comments welcome.

CADaver

  • Guest
Re: Thinking about flatten...
« Reply #1 on: October 16, 2006, 01:06:24 PM »
all the more reason NOT to flatten.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Thinking about flatten...
« Reply #2 on: October 16, 2006, 01:18:07 PM »
There's a lot of perfectly valid reasons to flatten a drawing including a client that is willing to pay for it.

:)

It's a challenging problem Joe -- I've written more flatteners than I can count, using everything from reverse engineering dxb plots to stratified wmf exporting / importing w/hidden line removal. I don't have AC2007 on this machine, is it possible it's ET Flattener has been updated (and fixed)? Do you need hidden lines removed?
Engineering Technologist CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.com http://cadanalyst.slack.com http://linkedin.com/in/cadanalyst

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Thinking about flatten...
« Reply #3 on: October 16, 2006, 01:32:21 PM »
In order to keep the flattener in vanilla AC2006 <which may have pooched custom objects> from bombing I dumped the unresolved xrefs, did some errant block cleanup. Anyway, see if the the attached will be of any use.

Engineering Technologist CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.com http://cadanalyst.slack.com http://linkedin.com/in/cadanalyst

Joe Burke

  • Guest
Re: Thinking about flatten...
« Reply #4 on: October 16, 2006, 02:01:58 PM »
In order to keep the flattener in vanilla AC2006 <which may have pooched custom objects> from bombing I dumped the unresolved xrefs, did some errant block cleanup. Anyway, see if the the attached will be of any use.


Thanks, Michael. I'll look at it soon, but iI need some sleep now.

It's comforting to hear someone with your level of expertise has condidered the issues beyond what's readily available.

BTW, I'm using vanilla 2006.

I'll post a clearer example of the dillema I talking about soon.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Thinking about flatten...
« Reply #5 on: October 16, 2006, 02:18:31 PM »
It's comforting to hear someone with your level of expertise has condidered the issues beyond what's readily available.

BTW, I'm using vanilla 2006.

I'll post a clearer example of the dillema I talking about soon.

Sorry, I glossed over all the issues. IMO ... <colored by the deliverables I've had to produce over the years> The flattened product should be 100% WCS, regardless the various coordinate systems the geometry may sport. Layer retention and hidden line removal should be optional. Custom objects should be accurately rendered (may require proper object enablers etc). The flattened product should be free of any external dependencies. Obviously the flattener shouldn't bomb. Have you looked at any Autodesk LISP coding? The bulk of it can hardly be considered "professionally written"; but I digress.

The last flattener I wrote, which was many years ago used the wmf import / export technique (something I shared with Autodesk <in person> long before they came out with the ET Flattener). The accuracy is terrible unless you employ a tiling system to establish minimum areas to process (accuracy of wmf being a function of view resolution settings, screen resolution and zoom level). Bentley <more precisley the formely Rebis divisions> were working on a flattener that utilized the ObjectARX HLR algorithm (i.e. way better accuracy) . I don't know what state it's in or it's availability.

OT: I thought, needs sleep? Where does he live? Answer: Hawaii. I just heard on the news about the earthquake, hope you, your family and your island mates are all ok!!

Edit: Fixed spelling, re-organized thoughts.
« Last Edit: October 16, 2006, 02:55:40 PM by MP »
Engineering Technologist CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.com http://cadanalyst.slack.com http://linkedin.com/in/cadanalyst

T.Willey

  • Needs a day job
  • Posts: 5247
Re: Thinking about flatten...
« Reply #6 on: October 16, 2006, 02:23:35 PM »
OT: I thought, needs sleep? Where does he live? Answer: Hawaii. I just heard on the news about the earthquake, hope you and your island mates are ok!!
Second!  Hope all is good for you and your family Joe.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Tramber

  • Guest
Re: Thinking about flatten...
« Reply #7 on: October 16, 2006, 03:01:06 PM »
Joe !
I've seen your dwg and use the official macro :
Code: [Select]
_move;_all;;0,0,0;0,0,1e99;_move;_p;;0,0,0;0,0,-1e99;
The problem is that I used it on all objects and it spreat some of the red 3poly on the top to incredible points (at huge X and Y).
So, if we exept the problem withe those few elements that I finally removed before the macro, the macro seems to be convenient and fast. Don't know if you know it.

Joe Burke

  • Guest
Re: Thinking about flatten...
« Reply #8 on: October 17, 2006, 12:42:22 PM »
Here's the example drawing I mentioned. It uses a text object to demonstrate my question regarding flatten.

TIA to all who have an opinion.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Thinking about flatten...
« Reply #9 on: October 17, 2006, 12:52:51 PM »
IMO the exercise of flattening is primarilly one of appearance, so while one might be tempted to retain objects in their native format as much as possible, you can't always have both, as evidenced by text / attributes etc. with a normal other than 0, 0, 1.

The upshot is you will have to choose between leaving some objects in their native format with a ucs or force wcs by replicating said objects with primitives (lines, arcs ad infinitum) so forshortening etc. is replicated faithfully. Simply from a consistency perspective I have to vote for the latter, as inconvenient as it may be and the data loss it may represent. If I want data / intelligence I go to the source documents, not flattened ones => they're dumb by definition.

/2.

:)
Engineering Technologist CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.com http://cadanalyst.slack.com http://linkedin.com/in/cadanalyst

CAB

  • Global Moderator
  • Seagull
  • Posts: 10395
Re: Thinking about flatten...
« Reply #10 on: October 17, 2006, 01:17:15 PM »
I tend to agree with Michel. It may depend on your purpose for flattening the drawing.
My goal when flattening is to have the geometry at one z & the text would also be at that
z, usually zero, and usually USC World. But I live in a simple environment. :-)
I've reached the age where the happy hour is a nap. ()
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Joe Burke

  • Guest
Re: Thinking about flatten...
« Reply #11 on: October 17, 2006, 01:38:54 PM »
Michael,

The idea there may not be a simple answer to the question confirms my dillema. Thank you. I can live with that.

I guess it means you might want two programs. One aimed at maintaining visual integrity, and another more inclined toward data integrity. I think trying to make one program do both, with some user supplied option, would be messy at best.

Joe Burke

  • Guest
Re: Thinking about flatten...
« Reply #12 on: October 17, 2006, 02:13:28 PM »
A tangent question regarding the example file I posted.

How to transform the text object at the top of the drawing to WCS as shown at the bottom of the drawing using a 4x4 matrix derived from the the odd normal. IOW, use the tansformby method to rotate the object twice. Once along the X axis and once along the Y axis in one operation.

This rather than a brute force method which forces a new normal of (0.0 0.0 1.0) on the object, and then deals with the fallout regarding the willl move in space once that's done.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Thinking about flatten...
« Reply #13 on: October 17, 2006, 05:24:54 PM »
Hi Joe, why not just do something like the following?

Code: [Select]
(defun foo ( textEntity / data x y newInsertPoint newAlignPoint newNormal )

    ;;  <idea code more than anything>

    (setq
        data           (entget textEntity)
        newInsertPoint (trans (cdr (assoc 10 data)) textEntity 0)
        newInsertPoint (append (mapcar 'set '(x y) newInsertPoint) '(0))
        newAlignPoint  (trans (cdr (assoc 11 data)) textEntity 0)
        newAlignPoint  (append (mapcar 'set '(x y) newAlignPoint) '(0))
        newNormal     '(0.0 0.0 1.0)
    )
   
    (entmod
        (subst
            (cons 210 newNormal)
            (assoc 210
                (setq data
                    (subst
                        (cons 11 newAlignPoint)
                        (assoc 11
                            (setq data
                                (subst
                                    (cons 10 newInsertPoint)
                                    (assoc 10 data)
                                    data
                                )
                            )   
                        )
                        data
                    )   
                )
            )
            data
        )   
    )
)

Or did I misinterpret your intent?

Edit: Forced Z ordinate of 0.0, something I missed in the first version.
« Last Edit: October 17, 2006, 05:41:33 PM by MP »
Engineering Technologist CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.com http://cadanalyst.slack.com http://linkedin.com/in/cadanalyst

Joe Burke

  • Guest
Re: Thinking about flatten...
« Reply #14 on: October 18, 2006, 09:56:34 AM »
Thanks, Michael. That seems to solve a separate issue which I won't bother getting into here.

The academic question was is there a way to sort of reverse engineer an object's Normal property? IOW, convert it to a 4x4 matrix which could then be passed to (vla-transformby <obj> (vlax-tmatrix <matrix>)). The desired result is the object's Normal property is (0.0 0.0 1.0) after it is transformed. Without forcing the property on the object.

"Academic" is the keyword. I'm just curious because it seems like it should be possible.

Regards