I've been trying to use the excellent code from elsewhere on this forum from inside Excel to draw boxes and text in IntelliCAD.
It draws the text but not the boxes.
When I do an audit, the message I get is this-
AcDb3dSolid(208CA), Modeling operation error:
Data stream is empty, Validation: <Invalid>, Default value is: < Removed>.
I have found by experiment that every function I can find using IntelliCAD.Solid3D gives this error. Lines, circles, 3DFace all work,
I am not able to try the code inside the CAD because the vba IDE is not activated (our computer department policy, I guess), even though the IntelliCAD library is present so I can reference it from inside Excel. My pathway to run vba is via another host like Excel.
Here is the start of the code to get the instance of IntelliCAD (this always works and is an adaption of some AutoCad instance code)-
Code: Select all
Public Sub startIcad()
Dim doc As IntelliCAD.Document
Dim AcAppClID As String
AcAppClID = "ICAD.Application"
Dim tAcObj As IntelliCAD.Application
On Error Resume Next
'try if AutoCAD already is started
Set tAcObj = GetObject(, AcAppClID)
If tAcObj Is Nothing Then
'AutoCAD is not running or not reacting, so we create a new process
Set tAcObj = CreateObject(AcAppClID)
End If
If tAcObj Is Nothing Then
'if that failed too something not correct
Else
'### icad vba test area
Call AddBoxEx2(tAcObj) 'not working
The 3D routine is similar to the one posted elsewhere on this forum except it has to link to the document object a different way as we are outside the CAD application.
Code: Select all
Public Sub AddBoxEx2(tAcObj As IntelliCAD.Application)
Dim myDoc As IntelliCAD.Document
Dim pt As IntelliCAD.Point
Dim t As IntelliCAD.text
Dim s As IntelliCAD.Solid3D
Dim i As Integer
Set myDoc = tAcObj.ActiveDocument
Set pt = Library.CreatePoint(100, 200, 0)
For i = 1 To 10
pt.y = pt.y + 125
Set t = myDoc.ModelSpace.AddText("Hello World!", pt, 100)
t.Color.SetRGB i * 10, i * 15, i * 20
pt.x = pt.x - 100
' How to show box?
Set s = myDoc.ModelSpace.AddBox(pt, 100, 100, 100)
s.Color.SetRGB i * 10, i * 15, i * 20
pt.x = pt.x + 100
Next i
' zoom
tAcObj.ActiveDocument.Application.ZoomExtents
End Sub