Code Red > VB(A)
Having trouble importing a block using command line
(1/1)
bharless72:
--- Code - vb.net: ---Private Sub CommandButton1_Click() frmBPDETGen.Hide ThisDrawing.SendCommand "_Canc" & vbCrLf ThisDrawing.SendCommand "-i" & vbCrLf Wait 1 ThisDrawing.SendCommand "vvvv" & vbCrLf Wait 1 ThisDrawing.SendCommand "1" & vbCrLf Wait 1 ThisDrawing.SendCommand "1" & vbCrLf Wait 1 ThisDrawing.SendCommand "1" & vbCrLf Wait 1 ThisDrawing.SendCommand "0" & vbCrLfEnd Sub Sub Wait(Seconds As Single) Dim Start As Single Start = Timer Do While Timer < Start + Seconds DoEvents LoopEnd Sub
It seems like after the block is imported the commands after are completely ignored. Any help is appreciated .
EDIT (John): Added code tags.
57gmc:
The SendCommand method is asynchronous. It runs after you vba code finishes. You need to use the vba api to import a block and insert it. For example, below is how I insert a titleblock at 0,0 where strFileName is the path to the block.
--- Code - Visual Basic: ---'InsertTB: Dim dInsert(0 To 2) As Double dInsert(0) = 0#: dInsert(1) = 0#: dInsert(2) = 0# Set oTbNew = ThisDrawing.PaperSpace.InsertBlock(dInsert, strDest & strFileName, 1, 1, 1, 0) 'put tb on specific layer Set oNewLay = ThisDrawing.Layers.Add("TITLEBLK") oTbNew.Layer = oNewLay.Name
Navigation
[0] Message Index
Go to full version