progeCAD support, tips and troubleshooting forum. progeCAD works very similar to some versions of AutoCAD. Moderated.

Moderators: caddit, Moderators

#2180 by thomasullmann
Wed Sep 03, 2014 6:43 pm
Hallo all together here my new question.

with vba ist relativ easily to create an complex 3dsolid by using the add-methode. so i have designed a 3d solid of a concrete garage with a garage door , usual doors and windows. this all runs very well.

but now i want to define a block using the already construkted 3dsolid. it's Name is for examle "new_garage".

Is there a possibility to create a new block like this:


thank you for your help
thomas germany

#2181 by caddit
Mon Sep 08, 2014 1:30 pm

Here is an example from the developers:

Code: Select allSub CreateAndInsertBlock()

     Dim blkDef As Block
     Dim blkRef As BlockInsert
     Dim oSset As SelectionSet
     Dim insPt As New Point
     Dim blkName As String
     Dim i As Integer
     ' check if named selection set not in use
     For Each oSset In ThisDocument.SelectionSets
          If oSset.Name = "$MakeBlock$" Then
               Exit For
          End If
     ' create selection set
     Set oSset = ThisDocument.SelectionSets.Add("$MakeBlock$")
     ThisDocument.Utility.Prompt (vbCr & "Select objects to make block")
     ' pick insertion point of block
     Set insPt = ThisDocument.Utility.GetPoint(, vbCr & "Pick insertion point: ")
     ' enter block name
     blkName = InputBox(vbCr & "Enter block name: ", "Block Name")
     ' create block definition
     Set blkDef = ThisDocument.Blocks.Add(insPt, blkName)
     Call blkDef.AddItems(oSset)
     Set blkRef = ThisDocument.ModelSpace.InsertBlock(insPt, blkName, 1, 1, 1, 0)
     Set oSset = Nothing     ' optional
End Sub