Insert blocks from file ala Design Center

Insert blocks from file ala Design Center

Anonymous
Not applicable
268 Views
3 Replies
Message 1 of 4

Insert blocks from file ala Design Center

Anonymous
Not applicable
Since Design Center can insert blocks into a drawing by dragging them
from another file, can this be done with VBA yet? If I know the name of
a block that exists in a drawing file, can I insert it into my drawing
using code?

-mjm
0 Likes
269 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
I believe CopyObjects and ObjectDBX will help there

here's a function inspired by:
'copy block sample
'From: Tony Tanzillo (tony.tanzillo@caddzone.com)
'Remember that you must check "ObjectDBX 1.0 Type Library"
'from the Tools|References dialog.
it still needs some work because it should verify block exists before trying
to copy it but it should give you a start

Public Function GetBlockFromDwg(ByVal sSourceDwgName As String, ByVal
sBlkName As String, ByRef Target As AcadDocument) As AcadBlock
On Error GoTo Failed
Dim DbxDoc As AxDbDocument
Set DbxDoc = GetInterfaceObject("ObjectDBX.AxDbDocument")
DbxDoc.Open sSourceDwgName

Dim Objects(0 To 0) As AcadObject
Set Objects(0) = DbxDoc.Blocks(sBlkName)


DbxDoc.CopyObjects Objects, Target.Blocks
Set GetBlockFromDwg = Target.Blocks(sBlkName)
Set DbxDoc = Nothing
Failed:
End Function




"michael montagne" wrote in message
news:E6D71BAFCB6ACE3EBAD86D8CCB8D2F92@in.WebX.maYIadrTaRb...
> Since Design Center can insert blocks into a drawing by dragging them
> from another file, can this be done with VBA yet? If I know the name of
> a block that exists in a drawing file, can I insert it into my drawing
> using code?
>
> -mjm
>
0 Likes
Message 3 of 4

Anonymous
Not applicable
I appeciate the credit, but please try to keep my
email address out of sight of the spammers 🙂

--
AcadXTabs: Document Tabs for AutoCAD
http://www.acadxtabs.com


"Mark Propst" wrote in message news:80D592AF4C5BA172DEE24E7C5B18D34C@in.WebX.maYIadrTaRb...
> I believe CopyObjects and ObjectDBX will help there
>
> here's a function inspired by:
> 'copy block sample
> 'From: Tony Tanzillo
0 Likes
Message 4 of 4

Anonymous
Not applicable
sorry bout that, just pasted a clip from earlier post to ng
didn't even notice it has an addy
hope the spammers don't know about google! 🙂

but since you bring that up... that's an interesting question cause even
though i try to 'disguise' my email they still find it, i thought they had a
way to sniff the packet traffic directly and extract ips from that, other
wise how do I get so many generous offers to enhance the size of my anatomy?
(as if it weren't big enough already! indeed!)
:-)
I wish I were sophisticated enough to know how to edit my packets before
sending to somehow disable the ip - but since a transmission depends also on
an ack I don't even see how that's possible? - just completely ignorant in
that area.

Is there no way to access these groups without creating a mountain of spam
every morning? (yeah, get a spam blocker probably)



"Tony Tanzillo" wrote in message
news:749EB51D1245E52D824F776C4DEEBC51@in.WebX.maYIadrTaRb...
> I appeciate the credit, but please try to keep my
> email address out of sight of the spammers 🙂
>
0 Likes