TheSwamp

Code Red => VB(A) => Topic started by: Dave R on October 26, 2007, 04:04:48 PM

Title: Insert Block with Annotative Scale
Post by: Dave R on October 26, 2007, 04:04:48 PM
We have a number of symbols/blocks that are kept in a folder on the network. The blocks have been saved with their annotative property set to "Yes". I would like to be able to insert these blocks into a drawing with VBA and maintain the annotative property. I have not found a way to do this using VBA. Does anyone have any ideas.

AutoCAD 2008 SP1.
Title: Re: Insert Block with Annotative Scale
Post by: David Hall on October 26, 2007, 05:08:25 PM
Let me work on that
Title: Re: Insert Block with Annotative Scale
Post by: David Hall on October 26, 2007, 05:30:45 PM
I cant find any annotative properties in VBA except for AcadMLeaderStyles
Title: Re: Insert Block with Annotative Scale
Post by: Bob Wahr on October 26, 2007, 05:59:30 PM
I haven't don't much (anything really) with the annotative properties yet but looked at this a little bit.  From what I can see, there's no way to set the annotative property of a block.  It either is or isn't based on whether annotativedwg is set to 0 or 1 in the drawing.  If it's 1, there'snothing to maintain, it just is annotative.  Any chance you could clarify what you mean?
Title: Re: Insert Block with Annotative Scale
Post by: Dave R on October 29, 2007, 08:22:13 AM
I haven't don't much (anything really) with the annotative properties yet but looked at this a little bit.  From what I can see, there's no way to set the annotative property of a block.  It either is or isn't based on whether annotativedwg is set to 0 or 1 in the drawing.  If it's 1, there'snothing to maintain, it just is annotative.  Any chance you could clarify what you mean?

Bob -

Try this and you'll see what I mean. Create a block in a drawing and make it annotative. Now insert the block using the normal AutoCAD insert method. It remains annotative, i.e.: it will scale up and down as the drawing scale changes. Now try to insert the block using a VBA InsertBlock  method. The block will not be annotative. The same thing occurs when you wblock an annotative block to an external file and try to insert it using VBA.

Any clearer?
Title: Re: Insert Block with Annotative Scale
Post by: David Hall on March 13, 2008, 03:16:44 PM
OK, this is really making me mad.  How do you make annotative blocks if you are wblocking out the graphics?  I cant figure this stupid thing out.  I have tried wblocking out the graphics, opening the block.dwg and trying to use Bedit to set annotative to yes.  It keeps setting itself back to No.  Any ideas???????????
Title: Re: Insert Block with Annotative Scale
Post by: Guest on March 13, 2008, 03:25:34 PM
OK, this is really making me mad.  How do you make annotative blocks if you are wblocking out the graphics?  I cant figure this stupid thing out.  I have tried wblocking out the graphics, opening the block.dwg and trying to use Bedit to set annotative to yes.  It keeps setting itself back to No.  Any ideas???????????

Quote
ANNOTATIVEDWG
Specifies whether or not the drawing will behave as an annotative block when inserted into another drawing
Title: Re: Insert Block with Annotative Scale
Post by: Dave R on March 13, 2008, 03:55:30 PM
OK, this is really making me mad.  How do you make annotative blocks if you are wblocking out the graphics?  I cant figure this stupid thing out.  I have tried wblocking out the graphics, opening the block.dwg and trying to use Bedit to set annotative to yes.  It keeps setting itself back to No.  Any ideas???????????

Quote
ANNOTATIVEDWG
Specifies whether or not the drawing will behave as an annotative block when inserted into another drawing

That's fine if you use AutoCAD commands to insert the block. Try inserting it using a VBA InsertBlock method.
Title: Re: Insert Block with Annotative Scale
Post by: David Hall on March 13, 2008, 04:11:54 PM
OK, this is really making me mad.  How do you make annotative blocks if you are wblocking out the graphics?  I cant figure this stupid thing out.  I have tried wblocking out the graphics, opening the block.dwg and trying to use Bedit to set annotative to yes.  It keeps setting itself back to No.  Any ideas???????????


Quote
ANNOTATIVEDWG
Specifies whether or not the drawing will behave as an annotative block when inserted into another drawing

Well doesn't that just make me feel stupid!

Thanks Matt


OK, Dave, Ill bite, have we found a way at all to use VBA?
Title: Re: Insert Block with Annotative Scale
Post by: Guest on March 13, 2008, 04:15:02 PM
I was replying to CmdrDuh's post about WBLOCK'ing out the graphics.  In the newly wblock'ed drawing, you would have to change the ANNOTATIVEDWG variable to 1 to allow it to react to the annotation scale of the drawing it's being inserted into.

As for the VBA insert problem....... Um.... yeah...... . . . . . .  .  .  .  .    .    .    .    .
Title: Re: Insert Block with Annotative Scale
Post by: David Hall on March 13, 2008, 04:17:33 PM
No , Matt, I was saying I feel stupid b/c if I had actually read the whole thread, you wouldn't have had to tell me that.  No worries
Title: Re: Insert Block with Annotative Scale
Post by: Dave R on March 13, 2008, 04:37:32 PM

OK, Dave, Ill bite, have we found a way at all to use VBA?

Not yet. The only workaround I have at the moment is to have the block already inserted into a template file. There doesn't have to be a blockreference in the drawing, just a block in the blocks collection. That way I can use VBA to insert the block at any time and it will be annotative. Bit of a pain tho' having to keep blocks in the template "in case" I want to insert them into a drawing at some point. I'm sure there is probably a way to do this somehow, cos good ol' Autodesk wouldn't put out a defective product, would they?  ;-)
Title: Re: Insert Block with Annotative Scale
Post by: sinc on March 17, 2008, 12:32:03 AM
Maybe it has something with the schizophrenic trend toward .NET (for most of Autodesk, anyway).

In .NET, you can create Annotative blocks.  There's an "Annotative" property on Block Records - just set it to true.  I'm guessing it's also exposed in ObjectARX, although I haven't looked.  VBA might be the odd man out.  (Oh, and I don't know if you can do it in Lisp, either.)
Title: Re: Insert Block with Annotative Scale
Post by: Dave R on March 17, 2008, 12:41:49 PM
Maybe it has something with the schizophrenic trend toward .NET (for most of Autodesk, anyway).

In .NET, you can create Annotative blocks.  There's an "Annotative" property on Block Records - just set it to true.  I'm guessing it's also exposed in ObjectARX, although I haven't looked.  VBA might be the odd man out.  (Oh, and I don't know if you can do it in Lisp, either.)

Unfortunately I'm not far enough along with C# yet to tackle something like that. Still trying to get the fundamentals down.
Title: Re: Insert Block with Annotative Scale
Post by: David Hall on April 09, 2008, 03:03:59 PM
me either, but Im going to go see if i can find it
Title: Re: Insert Block with Annotative Scale
Post by: David Hall on April 09, 2008, 03:43:44 PM
I found HERE (http://through-the-interface.typepad.com/through_the_interface/2007/05/using_a_jig_fro.html) C# code to insert a block, and HERE (http://through-the-interface.typepad.com/through_the_interface/2007/05/using_a_jig_fro_1.html) the annotative options.

At this point, I'm going to go read about it.  I'm not quite ready to try and code it other than copy/paste
Title: Re: Insert Block with Annotative Scale
Post by: David Hall on April 10, 2008, 11:53:48 AM
I had a thought today that might work.  Whilst learning C#, I learned how to search a blocktable for a value, and if not there, insert it.  What if, (bear with me, as this is not the ideal choice by any means), we had a drawing that contained all our blocks, which we insert into the current dwg, and erase, thus defining all the blocks.  Then we can insert blocks via VBA and the ones that are annotative behave properly.  When we go to insert a block, check the blocktable for our "master" block.  If it has been purged, reinsert it to redefine our missing blocks, and move on to the block we want.