Author Topic: Insert multiple drawings as blocks in array  (Read 694 times)

0 Members and 1 Guest are viewing this topic.

cangelo3d

  • Mosquito
  • Posts: 1
Insert multiple drawings as blocks in array
« on: May 01, 2012, 06: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)

fixo

  • Swamp Rat
  • Posts: 783
  • Pietari, Venäjä
Re: Insert multiple drawings as blocks in array
« Reply #1 on: May 01, 2012, 11:10:07 pm »
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'~
\\\"Always drink upstream from the herd."\\\ - Will Rogers, was died in 1935 plane crash

--> Donate to TheSwamp <--

BlackBox

  • Water Moccasin
  • Posts: 2261
Re: Insert multiple drawings as blocks in array
« Reply #2 on: May 02, 2012, 12:23:41 am »
« Last Edit: May 02, 2012, 12:28:18 am by RenderMan »
"Potential has a shelf life." - Margaret Atwood