Making Whole drawing as a block
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web cadforums.net
Making Whole drawing as a block

 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA
Author Message
balu_sukan
Guest





Posted: Mon Mar 28, 2005 7:20 pm    Post subject: Making Whole drawing as a block Reply with quote

Hi,
How can i Make, Whole drawing as a block by VBA.
How can i add selected objects to a block by VBA.

Balu.

Back to top
juno
Guest





Posted: Mon Mar 28, 2005 9:07 pm    Post subject: Re: Making Whole drawing as a block Reply with quote

I think you are asking two different questions here. The answer to your first question is: you can not make a whole drawing a block (model space or paper space at a time).

The answer to your second question is:
mk:@MSITStore:C:\Program%20Files\Common%20Files\Autodesk%20Shared\ACADAUTO.CHM::/idh_blocks_collection.htm
Back to top
Paul Richardson
Guest





Posted: Tue Mar 29, 2005 5:13 am    Post subject: Re: Making Whole drawing as a block Reply with quote

Balu, This should get you started.
gl
Paul

'<code>
Sub blockOut()
Dim ssObject As AcadSelectionSet
Dim insPt(2) As Double
Dim iJc As Integer
Dim blkScale As Integer: blkScale = 1

insPt(0) = 0: insPt(1) = 0: insPt(2) = 0

With ThisDrawing

ReDim blockobjects(0 To .ModelSpace.Count - 1) _
As AcadEntity

Set ssObject = .SelectionSets.Add("SS")

For iJc = 0 To .ModelSpace.Count - 1
Set blockobjects(iJc) = .ModelSpace(iJc)
Next iJc

ssObject.AddItems blockobjects

.Wblock "C:\Test.dwg", ssObject

ssObject.Erase

.ModelSpace.InsertBlock insPt, _
"C:\Test.dwg", blkScale, blkScale, blkScale, insPt(0)

.SelectionSets("SS").Delete

End With

Kill "c:\Test.dwg"

End Sub
'<code/>


"balu_sukan" <nospam@address.withheld> wrote in message
news:12716749.1112019667255.JavaMail.jive@jiveforum2.autodesk.com...
Quote:
Hi,
How can i Make, Whole drawing as a block by VBA.
How can i add selected objects to a block by VBA.

Balu.


Back to top
bcoward
Guest





Posted: Tue Mar 29, 2005 8:06 am    Post subject: Re: Making Whole drawing as a block Reply with quote

Paul,

Couldn't you use the CopyObjects method? If you did you could finish this code so I don't have to...lol

I haven't plugged this up but it saves the iteration loop so I'm thinking it might be a little more streamlined.

The AutoCAD VBA help files do indicate "To copy multiple objects, use the CopyObjects method or create an array of objects to use with the Copy method....."

Dim AcadDoc as AcadDocument
Dim SSet as AcadSelectionSet
Dim SSetArray as Object

Set AcadDoc = ThisDrawing.Application.Documents("MyDrawing")
Set SSet = GetSSetAll()
ThisDrawing.CopyObjects SSetArray(SSet), AcadDoc.ModelSpace


Good luck,

Bob Coward
CADS, Inc

800-366-0946
bcoward@mindspring.com
Back to top
Paul Richardson
Guest





Posted: Tue Mar 29, 2005 8:29 am    Post subject: Re: Making Whole drawing as a block Reply with quote

sure if you want to write nice efficient code..;)
"bcoward" <nospam@address.withheld> wrote in message
news:6355685.1112065610859.JavaMail.jive@jiveforum1.autodesk.com...
Quote:
Paul,

Couldn't you use the CopyObjects method? If you did you could finish this
code so I don't have to...lol

I haven't plugged this up but it saves the iteration loop so I'm thinking
it might be a little more streamlined.

The AutoCAD VBA help files do indicate "To copy multiple objects, use the
CopyObjects method or create an array of objects to use with the Copy
method....."

Dim AcadDoc as AcadDocument
Dim SSet as AcadSelectionSet
Dim SSetArray as Object

Set AcadDoc = ThisDrawing.Application.Documents("MyDrawing")
Set SSet = GetSSetAll()
ThisDrawing.CopyObjects SSetArray(SSet), AcadDoc.ModelSpace


Good luck,

Bob Coward
CADS, Inc

800-366-0946
bcoward@mindspring.com
Back to top
 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server DSP VoIP Electronics New Topics
Powered by phpBB