Is there a way through vba to insert an exploded block? I have tried naming
the block with a "*" in front of it but I get a "Filer Error" when I run the
program. I have also tried objBlock.Explode but that leaves individual
lines of text not Mtext.
can you post your code if the above doesn't work?
--
Kevin
"Rob Peterson" <autodesk.autocad.customization.vba> wrote in message
news:D1DC52420CD44D9D...@in.WebX.maYIadrTaRb...
What you suggested did not work, the mcFile in place of ThisDrawing gave me
an error message of "variable not defined". Below is the part of the code
that I am using to insert the blocks. What is mcFile? I have looked in the
Object Browser and nothing shows up. Let me know if you (or anybody else)
has any suggestions.
Private Sub cmdCreate_Click()
frmNotes.Hide
With ThisDrawing.Utility
.InitializeUserInput 1
StartPnt = .GetPoint(, vbCr & "Pick starting point: ")
End With
' Header
TextPortion = "general"
Set objText = ThisDrawing.ModelSpace.InsertBlock(StartPnt, TextPortion &
".dwg", 1, 1, 1, 0)
Dim minExt As Variant
Dim maxExt As Variant
objText.GetBoundingBox minExt, maxExt
TextPnt(0) = StartPnt(0)
TextPnt(1) = minExt(1) - 3.75
TextPnt(2) = StartPnt(2)
' Design Stresses
If optAisc.Value = True Then
TextPortion = "aisc"
Else
TextPortion = "aashto"
End If
Set objText = ThisDrawing.ModelSpace.InsertBlock(TextPnt, TextPortion &
".dwg", 1, 1, 1, 0)
End Sub
"Kevin Terry" <kev...@jaypro.com> wrote in message
news:0DF55B3E28CA2E51...@in.WebX.maYIadrTaRb...
Another simple approach is to write a program with the text hard coded in
the program, or for the program to read a user selected file and lastly ask
the user for an insertion point.
A user interface could put the relevant default text in a dialog box for
editing prior to insertion in the drawing - also you could set text style
and height parameters and select layer from the interface.
--
Laurie Comerford
CADApps
www.cadapps.com.au
"Mark_Abercrombie" <r23...@email.sps.mot.com> wrote in message
news:f128...@WebX.maYIadrTaRb...
> You might consider saving the notes as text files. You can then read the
text file and create an MTEXT object directly without inserting a block.
ThisDrawing.SendCommand "explode" & vbCr & "l" & vbCr & vbCr
This should explode the last object created in the drawing...your block.
Hope this helps...Vaughn
"Rob Peterson" <autodesk.autocad.customization.vba> wrote in message
news:D1DC52420CD44D9D...@in.WebX.maYIadrTaRb...
I'm not sure why your code won't work as is, I can't tell for sure because
you have used some global or form level variables (objText) that could
either be text objects or blocks (or they are simply not defined). Are you
using Option Explicit at the top of your form? Can you post any global
declarations you are using? Then I might better see what you are trying to
do here, and/or offer a solution.
I'm going to take a stab here, don't hold me responsible if it doesn't work
exactly as desired though:
'your code, slightly changed:
Private Sub cmdCreate_Click()
Dim aBlock As AcadBlockReference
frmNotes.Hide
With ThisDrawing.Utility
.InitializeUserInput 1
StartPnt = .GetPoint(, vbCr & "Pick starting point: ")
End With
' Header
TextPortion = "general"
'what kind of variable is objText?
Set aBlock = ThisDrawing.ModelSpace.InsertBlock(StartPnt, TextPortion &
".dwg", 1, 1, 1, 0)
aBlock.Explode
aBlock.Delete
Dim minExt As Variant
Dim maxExt As Variant
aBlock.GetBoundingBox minExt, maxExt
TextPnt(0) = StartPnt(0)
TextPnt(1) = minExt(1) - 3.75
TextPnt(2) = StartPnt(2)
' Design Stresses
If optAisc.Value = True Then
TextPortion = "aisc"
Else
TextPortion = "aashto"
End If
Set aBlock = ThisDrawing.ModelSpace.InsertBlock(TextPnt, TextPortion &
".dwg", 1, 1, 1, 0)
'what's going to happen next?
End Sub
--
Kevin
"Rob Peterson" <autodesk.autocad.customization.vba> wrote in message
news:1B4326015039FC3D...@in.WebX.maYIadrTaRb...
Rob
"Vaughn Hamilton" <vham...@ghpud.org> wrote in message
news:2885BC50A68549D5...@in.WebX.maYIadrTaRb...