TheSwamp

Code Red => VB(A) => Topic started by: cangelo3d on May 01, 2012, 07:08:03 AM

Title: Insert multiple drawings as blocks in array
Post by: cangelo3d on May 01, 2012, 07:08:03 AM
I am totally new to vba programming and unfortunately i have problem sorting out basic things.
What i want to achieve:

user sets amount of times each block is to be inserted,
user picks a point for block1,
system creates an array of one row and i numbers of columns (i=defined by the user in previous step)
user picks a point for block2,
system creates an array of one row and i numbers of columns (i=defined by the user in previous step)
and so on...

anyone has any suggestions on how to procced?
anything would be much appreciated!

(i am running vba through autocad 2012)
Title: Re: Insert multiple drawings as blocks in array
Post by: fixo on May 02, 2012, 12:10:07 AM
See MinsertBlock method in the Help file:
Code: [Select]
Option Explicit

Public Sub TestForBlockArray()
Dim acsp As AcadBlock
Set acsp = ThisDrawing.ActiveLayout.Block
Dim pt(2) As Double
Dim blkname  As String
Dim NumRows As Long, _
NumColumns As Long, _
RowSpacing As Long, _
ColumnSpacing As Long
NumRows = 24
NumColumns = 12
RowSpacing = 700
ColumnSpacing = 350
blkname="foo"    '<-- block name
acsp.AddMInsertBlock pt, blkname, 1, 1, 1, 0, NumRows, NumColumns, RowSpacing, ColumnSpacing
End Sub

~'J'~
Title: Re: Insert multiple drawings as blocks in array
Post by: BlackBox on May 02, 2012, 01:23:41 AM
** Edit - Post deleted... I thought this thread was familiar:

http://www.cadtutor.net/forum/showthread.php?68984-Insert-multiple-drawings-as-blocks-in-array (http://www.cadtutor.net/forum/showthread.php?68984-Insert-multiple-drawings-as-blocks-in-array)