Author Topic: Quickly Inserting Blocks  (Read 5040 times)

0 Members and 1 Guest are viewing this topic.

ronjonp

  • Needs a day job
  • Posts: 7531
Re: Quickly Inserting Blocks
« Reply #15 on: May 05, 2010, 07:42:56 AM »
MP,

I'm using it for the speed verses vla-insert. The entmake is about 5 times faster in AutoCAD 2009. I tried the entlast to vla method and entmake (cdr (assoc -1)) but then all the speed gains were lost. I guess the more version independent universal method is to insert via vla.


Thanks for taking the time to reply :).

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Lee Mac

  • Seagull
  • Posts: 12926
  • London, England
Re: Quickly Inserting Blocks
« Reply #16 on: May 05, 2010, 07:52:43 AM »
When using the entmake method - I assume that the Inserts can only be 'entmade' if the block definition exists in the block table, so if it doesn't would you use something like:

Code: [Select]
(command "_.insert" <block filepath>) (command)

To create it?

I don't see this problem with vla-insert, I suppose thats the sacrifice of speed.  :|

ronjonp

  • Needs a day job
  • Posts: 7531
Re: Quickly Inserting Blocks
« Reply #17 on: May 05, 2010, 08:11:01 AM »
Lee,

The block definition already exists in the drawing. I really wish this entmake behaved the same between acad versions.  :-(

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Lee Mac

  • Seagull
  • Posts: 12926
  • London, England
Re: Quickly Inserting Blocks
« Reply #18 on: May 05, 2010, 08:29:54 AM »
Oh right  :-)

I was just considering the case in which it didn't  :-)

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Quickly Inserting Blocks
« Reply #19 on: May 05, 2010, 08:38:33 AM »
I'm using it for the speed verses vla-insert. The entmake is about 5 times faster in AutoCAD 2009. I tried the entlast to vla method and entmake (cdr (assoc -1)) but then all the speed gains were lost. I guess the more version independent universal method is to insert via vla.

Thanks for taking the time to reply :).

You're very welcome Ron. Parting gift:

reliability > speed

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

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Quickly Inserting Blocks
« Reply #20 on: May 05, 2010, 10:21:29 AM »
Just to be clear, this took a big performance hit over entmakex?
Code: [Select]
(defun rjp-insertcan2 (pt layer sc val / elst)
  (if (setq elst
             (entmake (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)))))
                      )
             )
      )
    (vlax-ename->vla-object (cdr (assoc -1 elst)))
  )
)
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.

ronjonp

  • Needs a day job
  • Posts: 7531
Re: Quickly Inserting Blocks
« Reply #21 on: May 05, 2010, 04:13:52 PM »
CAB,

From the test I did the insertion time went to over 40 seconds  :?(compared to 6.5). I'll give it another test when I get back to the office.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Quickly Inserting Blocks
« Reply #22 on: May 05, 2010, 05:10:57 PM »
If it is the same block, can you just insert it once, and then copy it to the other points?
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 #23 on: May 05, 2010, 06:24:24 PM »
If it is the same block, can you just insert it once, and then copy it to the other points?

I suppose I could try that :) Thanks Tim.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

ronjonp

  • Needs a day job
  • Posts: 7531
Re: Quickly Inserting Blocks
« Reply #24 on: May 05, 2010, 06:57:31 PM »
CAB,

From the test I did the insertion time went to over 40 seconds  :?(compared to 6.5). I'll give it another test when I get back to the office.

Well I ran the test again...these two were just about the same:

  (vlax-ename->vla-object
    (entmakex (list '(0 . "INSERT")... vs. (entmakex then (vlax-ename->vla-object (entlast))

The (if (setq el ... (vlax-ename->vla-object (cdr (assoc -1 el))) kept breaking in 2009 with that same invalid entity name error i was seeing in 2008. :pissed:

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC