Author Topic: Trimming selection set  (Read 7315 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.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Trimming selection set
« Reply #15 on: October 29, 2005, 03:03:44 PM »
Martin,

If you have not already you may want to look into the clipit.lsp in the expresstools directory.

Oleg,
It sure is a privilege to have Micheal here and I learn from every post.

aka ab2draft
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.

Fatty

  • Guest
Re: Trimming selection set
« Reply #16 on: October 29, 2005, 04:54:56 PM »
Martin,

If you have not already you may want to look into the clipit.lsp in the expresstools directory.

Oleg,
It sure is a privilege to have Micheal here and I learn from every post.

aka ab2draft

Absolutely agree with you, CAB

Anyway all forums likes to me and on all of these forums many worthy and respected programmers

I don't remember who from the great people were said the following:
We will see further, because we are stands on the shoulders of our teachers
I know that pearls it falls not in each cockleshell

Oleg

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Trimming selection set
« Reply #17 on: October 29, 2005, 05:34:27 PM »
I say this with absolute sincerity --

In my career thus far I learned the most from a former boss named Ian -- more times than I can count he put me in positions where I had to become an expert overnight (I didn't even want to learn lisp -- I thought it goofy, clunky), the value of high intensity self directed study, that I had to be bold, even brazen about my skills or no one would take me seriously and that ultimately, I could make three times as much money by working for someone else.

As for these forums, I can honestly say the most learning occurs when you attempt to share the little bit of skill you have in a way that's meaningful to others. Want to learn? Try to teach. Unexpected side effect: It's plain fun and rewarding in a way I can't quite describe, but I love it. I wish I could do it full time and still afford to buy guitar toys and support my wife.

:)
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 #18 on: October 29, 2005, 06:55:35 PM »
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.

Oleg, It sure is a privilege to have Micheal here and I learn from every post.

Man, thank you so much guys. One day I will be worthy praise like this. The kindnesses and generosity you guys shower upon me pushes me to try to attain that goal sooner, rather than later.

Thanks again.

<nodding.gif>

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