Author Topic: How would one get the Vertex Object?  (Read 2319 times)

0 Members and 1 Guest are viewing this topic.

T.Willey

  • Needs a day job
  • Posts: 5247
How would one get the Vertex Object?
« on: October 19, 2006, 01:56:38 PM »
I mean how can one step through an AcDb2dPolyline to get the vertex objects?  I know you can do it with enames and entnext, but is there way way with straight ActiveX controls?  Question just popped into my head, and I didn't have/find an answer.

Thanks.
Tim

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

Please think about donating if this post helped you.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: How would one get the Vertex Object?
« Reply #1 on: October 19, 2006, 02:20:49 PM »
Mnimal / brute force / concept code --

Code: [Select]
(defun foo ( document 2dPlineObject / result )
    (   
        (lambda ( objectID )
            (while
                (eq "AcDb2dVertex"
                    (vla-get-objectname
                        (setq object
                            (vla-objectidtoobject
                                document
                                objectID
                            )
                        )
                    )
                )
                (setq
                    result   (cons object result)
                    objectID (+ 8 objectID)
                )
            )
        )       
        (+ 8 (vla-get-objectID 2dPlineObject))
    )
    (reverse result)
)

:)
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: How would one get the Vertex Object?
« Reply #2 on: October 19, 2006, 02:22:31 PM »
<not compatible with object dbx because of the vla-objectidtoobject call which works strictly in an active document context>
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: How would one get the Vertex Object?
« Reply #3 on: October 19, 2006, 02:29:21 PM »
Is the the same way 'entnext' works?  Finds the code (hex?) of the object, and then adds one (8 because of hex number system) number to it?  Very interesting.  I would never have thought of doing it this way.
Tim

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

Please think about donating if this post helped you.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: How would one get the Vertex Object?
« Reply #4 on: October 19, 2006, 02:33:13 PM »
Is the the same way 'entnext' works?

Kinda, insomuch as they are sequential entiies / objects.

Finds the code (hex?) of the object, and then adds one (8 because of hex number system) number to it?

No, nothing to do with hex. Just my observataion that ObjectIDs are issued as a multiple of 8.

Caution -- not tried against polylines with modified / deleted vertices -- driver beware.

:)
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: How would one get the Vertex Object?
« Reply #5 on: October 19, 2006, 02:37:48 PM »
Thanks again Michael.  I think this must be the only way.  I was hoping there was something simple I missed, like (vlax-invoke BlkObj 'GetAttributes), but for polylines.
Tim

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

Please think about donating if this post helped you.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: How would one get the Vertex Object?
« Reply #6 on: October 19, 2006, 02:39:36 PM »
My pleasure. I think it more of a demonstration of the <cough> complete object model Autodesk authored.

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