Author Topic: Quickly Inserting Blocks  (Read 5041 times)

0 Members and 1 Guest are viewing this topic.

ronjonp

  • Needs a day job
  • Posts: 7531
Quickly Inserting Blocks
« on: May 04, 2010, 02:54:11 PM »
Does anyone of you Ninja Maestro's have any tricks that could be used to quickly insert say 100,000 blocks for a list of points. Right now I'm using a while loop with vla-insert and it takes about 35 seconds to insert only 35000.

Thanks,

Ron

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Quickly Inserting Blocks
« Reply #1 on: May 04, 2010, 02:58:45 PM »
I thought people said that entmake was quicker?
Tim

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

Please think about donating if this post helped you.

ronjonp

  • Needs a day job
  • Posts: 7531
Re: Quickly Inserting Blocks
« Reply #2 on: May 04, 2010, 03:05:17 PM »
Thanks for the reply Tim.

I have to populate an attribute in the block when inserting and change the color to a varying truecolor as well. I'll give the "entmaking" a whirl :)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Lee Mac

  • Seagull
  • Posts: 12926
  • London, England
Re: Quickly Inserting Blocks
« Reply #3 on: May 04, 2010, 03:11:59 PM »
Perhaps tricks like not calling for the active space every time? Entmaking is definitely faster, but might get complicated with lots of attribs...

ronjonp

  • Needs a day job
  • Posts: 7531
Re: Quickly Inserting Blocks
« Reply #4 on: May 04, 2010, 03:24:31 PM »
Perhaps tricks like not calling for the active space every time? Entmaking is definitely faster, but might get complicated with lots of attribs...

Thanks Lee :)  That's one of the first things I did after the thread (or spc (setq spc)) about not having multiple call to the active space. It did help a bit but I still want it to be faaaaaaaster  :lol:

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Lee Mac

  • Seagull
  • Posts: 12926
  • London, England
Re: Quickly Inserting Blocks
« Reply #5 on: May 04, 2010, 03:30:21 PM »
C++ ?  :lol:

ronjonp

  • Needs a day job
  • Posts: 7531
Re: Quickly Inserting Blocks
« Reply #6 on: May 04, 2010, 03:33:49 PM »
If I only speeka da language  :-)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

LE3

  • Guest
Re: Quickly Inserting Blocks
« Reply #7 on: May 04, 2010, 03:45:27 PM »
can be with c# too - maybe

ronjonp

  • Needs a day job
  • Posts: 7531
Re: Quickly Inserting Blocks
« Reply #8 on: May 04, 2010, 06:29:56 PM »
Using entmake and storing the data with xdata. 35000 points went from 30 seconds +- using vla-insert to just under 6.5 seconds  :-)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Quickly Inserting Blocks
« Reply #9 on: May 04, 2010, 06:42:18 PM »
Good to hear.  I was gonna ask how it went, and if not good, then maybe get more info to make better suggestions.
Tim

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

Please think about donating if this post helped you.

Hangman

  • Swamp Rat
  • Posts: 566
Re: Quickly Inserting Blocks
« Reply #10 on: May 04, 2010, 07:22:54 PM »
Good to hear. ...

Hey, I'm going to jump in here with something that is completely not a part of this thread nor this site.

Tim, I was curious about your link "ArtisticCrossroads" so I went to see it.
The mission statement is nice, ...   I take it that is what you are spending your time on these days, I don't see you around here much anymore.

Anyway, a small correction for easier reading.
Quote
... found their desired destination at a crossroad full of artist willing to share, ...
  Should have an 's' at the end of 'artist' as it is refering to a plural.

Keep crank'n.  :)
Hangman  8)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Drafting Board, Mechanical Arm, KOH-I-NOOR 0.7mm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Quickly Inserting Blocks
« Reply #11 on: May 04, 2010, 07:39:52 PM »
That has been pointed out, but the guy that does the site work has had issues in his life, where the site has fell but the wayside.  I hope we can get back on it again because I think it will be a good site, but until his life gets a little less hectic, the site is on hold.

I'm still around, just don't post as much, as others seems to have taken on that part.  I just post every-once-inawhile.

Thanks for the comment of the mission statement, as I wrote it, its nice to hear.
Tim

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

Please think about donating if this post helped you.

hermanm

  • Guest
Re: Quickly Inserting Blocks
« Reply #12 on: May 04, 2010, 10:47:52 PM »
Using entmake and storing the data with xdata. 35000 points went from 30 seconds +- using vla-insert to just under 6.5 seconds  :-)

and to think that Msoft, I mean Adesk, was trying to convince us @ 1 pt that AX is faster than trad ALISP.

..and we should hitch our (tiny) wagons to the falling star known as VBA

<smirk>

yeah, right   :|

ronjonp

  • Needs a day job
  • Posts: 7531
Re: Quickly Inserting Blocks
« Reply #13 on: May 05, 2010, 01:37:50 AM »
Ok.... so this code works fine in 2009 but bombs in 2008 (invalid entity name 0) anyone know why? The block is created but then craps out??
The app is registered and the block definition already exists.

Code: [Select]
(defun rjp-insertcan2 (pt layer sc val /)
  (vlax-ename->vla-object
    (entmakex (list '(0 . "INSERT")
  '(100 . "AcDbEntity")
  '(100 . "AcDbBlockReference")
  '(2 . "RJP_CatchCan")
  (cons 8 layer)
  (cons 10 pt)
  (cons 41 sc)
  (cons 42 sc)
  (cons 43 sc)
  (cons -3 (list (cons "Precipitation" (list (cons 1040 val)))))
    )
    )
  )
)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Quickly Inserting Blocks
« Reply #14 on: May 05, 2010, 07:18:31 AM »
Based on the most cursory and sleep deprived foray into this ... it appears that under 2008 the entmakex function returns the entity name of the owner when successful (contrary to the help docs) when creating an insert using the code you supplied, and since there is no owner in an entmakex call it's an invalid entity name (<Entity name: 0>). While clunky, you could return (entlast) to the parent call of vlax-ename->vla-object when said entmakex call is successful, e.g. (if (entmakex definition) (vlax-ename->vla-object (entlast))). An aside, and in contrast, entmake returns the dxf list when successful. I'm curious, why are you using entmakex?
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst