Author Topic: Trimming selection set  (Read 7317 times)

0 Members and 1 Guest are viewing this topic.

hmspe

  • Bull Frog
  • Posts: 362
Trimming selection set
« on: October 29, 2005, 02:05:34 AM »
I'm working on a generalized routine to automatically trim arcs drawn between symbols in electrical drawings.  The issue is that arc and circle components in the symbol block should be used as edges to trim to, but line and lwpolyline components should not.  I found code that explodes the symbol then gets all intersection points using:
 
    (setq 8list (vlax-invoke 8symbobj 'Explode))
    (foreach 8obj 8list
      (if (setq 8intpts (MyErrorCheck
                         'vlax-invoke
                         (list 8obj 'IntersectWith 8arcobj acExtendNone)
                       )
          )
        (progn        ....

8symbobj is the symbol block and 8arcobj is the intersecting arc.  A dump of 8list for a fluorescent strip block returns:

(#<VLA-OBJECT IAcadLine 033d8a24> #<VLA-OBJECT IAcadLine 033dd4a4> #<VLA-OBJECT
IAcadLine 033dd444> #<VLA-OBJECT IAcadCircle 033db304>)

I need to remove all the IAcadLine entities from 8list before calling the foreach loop.  I'm just getting started with the vl-/vla- end of lisp and don't have a clue how to do this.  Any guidance would be appreciated.

Martin   
"Science is the belief in the ignorance of experts." - Richard Feynman

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Trimming selection set
« Reply #1 on: October 29, 2005, 07:49:49 AM »
<coded blind>

If 8list needs to have a copy of every entity that results from exploding 8symbobj then this --

Code: [Select]
(setq filtered8list
    (vl-remove-if-not
       '(lambda (object)
            (member
                (vla-get-objectname object)
               '("AcDbArc" "AcDbCircle")
            )
        )
        8list
    )
)

Otherwise this should suffice --

Code: [Select]
(setq 8list
    (vl-remove-if-not
       '(lambda (object)
            (member
                (vla-get-objectname object)
               '("AcDbArc" "AcDbCircle")
            )
        )
        (vlax-invoke
            8symbobj
           'Explode
        )
    )
)

Warning -- I'm on my first coffee.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Trimming selection set
« Reply #2 on: October 29, 2005, 07:57:53 AM »
Ack, should have had the entire first cup before responding.

I had assumed because of your 'dump' text that (vlax-invoke 8symbobj 'Explode) was returning a list, it doesn't, it returns a variant array. Hang on a second ..
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Trimming selection set
« Reply #3 on: October 29, 2005, 08:04:07 AM »
Talking to myself ...

DUH ME, just noticed you're employing vlax-invoke, rather than vlax-invoke-method. In that case it will return a list rather than a variant array, and my first post should work.

All I ask is that all the beans that gave up their life for my coffee today have the highest amount of caffeine, is that too much too ask?

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

Fatty

  • Guest
Re: Trimming selection set
« Reply #4 on: October 29, 2005, 08:36:36 AM »
Talking to myself ...

DUH ME, just noticed you're employing vlax-invoke, rather than vlax-invoke-method. In that case it will return a list rather than a variant array, and my first post should work.

All I ask is that all the beans that gave up their life for my coffee today have the highest amount of caffeine, is that too much too ask?

 :roll:

Hi MP

Sorry I don't know your real name...

I think better yet you will drink beer instead coffee...

This likes me more:

Code: [Select]
(vl-member-if (function (lambda (x)
  (wcmatch (vla-get-objectname x)
  "AcDbArc,AcDbCircle")))
  (vlax-invoke (vlax-ename->vla-object (car (entsel))) 'Explode))

Regards,

Fatty



MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Trimming selection set
« Reply #5 on: October 29, 2005, 08:47:19 AM »
Michael's the name, insomnia's the game.

Yeah, that would work too.

Cats, and the many ways to skin 'em.

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

Fatty

  • Guest
Re: Trimming selection set
« Reply #6 on: October 29, 2005, 09:05:39 AM »
Michael's the name, insomnia's the game.

Yeah, that would work too.

Cats, and the many ways to skin 'em.

REOW!

Michael, thanks

They are say in Russia no difference: across or along

Oleg




MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Trimming selection set
« Reply #7 on: October 29, 2005, 09:12:07 AM »
Glad to make your acquaintance sir Oleg.

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

Fatty

  • Guest
Re: Trimming selection set
« Reply #8 on: October 29, 2005, 11:15:24 AM »
Glad to make your acquaintance sir Oleg.

:)

If I will be speak frankly, then I surmised, who you there is personally,
but I not was confident accurately of that.
Now I can say that you are an idol #1 for me and many other users
I do not know the reasons, which forced you not to appear at other forum (discussion.group) but this there is a large loss for them...

I remove my hat into the sign of respect for you
(Sorry for my bear English)

Fatty

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Trimming selection set
« Reply #9 on: October 29, 2005, 11:24:47 AM »
Whoa!

I don't deserve this praise, but I'm going to cherish it no less!

Thank you sir, you didn't need to say that -- you are obviously a man of great generousity, nothwithstanding your ability to quickly disect a problem and formulate an efficient and elegant solution.

Post.BookMarkNow ;

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

Fatty

  • Guest
Re: Trimming selection set
« Reply #10 on: October 29, 2005, 11:46:40 AM »
Whoa!

I don't deserve this praise, but I'm going to cherish it no less!

Thank you sir, you didn't need to say that -- you are obviously a man of great generousity, nothwithstanding your ability to quickly disect a problem and formulate an efficient and elegant solution.

Post.BookMarkNow ;

 :-o

I'm simple ex-worker and I know only simple words

I said only truth and nothing besides the truth...

I will memorize this day

Thanks Michael



hmspe

  • Bull Frog
  • Posts: 362
Re: Trimming selection set
« Reply #11 on: October 29, 2005, 12:10:34 PM »
Thanks, guys.

Martin
"Science is the belief in the ignorance of experts." - Richard Feynman

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Trimming selection set
« Reply #12 on: October 29, 2005, 01:21:15 PM »
I will memorize this day

As will I, be assured! Thank you Oleg.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Fatty

  • Guest
Re: Trimming selection set
« Reply #13 on: October 29, 2005, 01:57:59 PM »
I will memorize this day

As will I, be assured! Thank you Oleg.

Such difficult talking pulls my thick skin therefore today I will

make an escape from here

Regards

Oleg

hyposmurf

  • Guest
Re: Trimming selection set
« Reply #14 on: October 29, 2005, 02:16:14 PM »

Now I can say that you are an idol #1 for me and many other users

Fatty

I'd second that, you come up with some great code, strive to help other members so much with their requests and at the same time its all done in a polite manner, makes you one cool bloke.