Author Topic: Embed vba extension in a Drawing  (Read 951 times)

0 Members and 1 Guest are viewing this topic.

civil.eng

  • Newt
  • Posts: 66
Embed vba extension in a Drawing
« on: August 26, 2022, 11:43:36 AM »
Hello everyone,
I need a lisp routin or function to embed a DVB file (Autocad vba extension) into a drawing automatically from a address. Actually I know how to load and call a dvb with Lisp commands, I just need to embed it in drawing after loading it.

Does someone have any information about it ?

Thanks in advance.

BIGAL

  • Swamp Rat
  • Posts: 1434
  • 40 + years of using Autocad
Re: Embed vba extension in a Drawing
« Reply #1 on: August 26, 2022, 08:26:56 PM »
You can start a lisp / VBA on open a dwg but would run say for every open is that what you want ? You could do question exit not for this dwg. Its just a case of getting the autoload lisp's in correct order, maybe use s::startup function.
A man who never made a mistake never made anything

57gmc

  • Bull Frog
  • Posts: 367
Re: Embed vba extension in a Drawing
« Reply #2 on: August 30, 2022, 11:09:31 AM »
The only way AutoCAD provides to embed a dvb file is by using the VBAMAN command. But since it uses a dialog, there's no way to script it.

Perhaps if you explain why you need something like this, we could help you figure out an alternative.
« Last Edit: August 30, 2022, 11:12:49 AM by 57gmc »

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8795
  • AKA Daniel
Re: Embed vba extension in a Drawing
« Reply #3 on: August 31, 2022, 12:25:58 AM »
you can store files in an xrecord

here's a .NET sample https://www.theswamp.org/index.php?topic=26687.0

you may be able to do this with lisp.

-convert the file to a byte array.
-chop the array into 127 byte chunks.
-write to an xrecord

reverse it to get the file

mhupp

  • Bull Frog
  • Posts: 250
Re: Embed vba extension in a Drawing
« Reply #4 on: August 31, 2022, 07:52:36 AM »
That's crazy would their be a file size limit? like anything under 1mb so a simple spread sheet?

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8795
  • AKA Daniel
Re: Embed vba extension in a Drawing
« Reply #5 on: August 31, 2022, 08:20:52 AM »
That's crazy would their be a file size limit? like anything under 1mb so a simple spread sheet?

Yeah, I don't know if there is a theoretical size limit, I think there's certainly a practical one, to where it just becomes painfully slow