| Author |
Message |
balu_sukan
Guest
|
Posted:
Mon Mar 28, 2005 7:20 pm Post subject:
Making Whole drawing as a block |
|
|
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 |
|
|
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 |
|
|
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 |
|
|
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 |
|
|
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 |
|
 |
|
|
|
|