Page 2 of 2

Re: New tool to IntelliCAD : Create Construct Entities

Posted: Sat Feb 21, 2026 9:25 am
by QuanNguyen
MARTIN L wrote:
Sat Feb 21, 2026 7:09 am
Sub FTE ()
^C^C-LAYER;M;FTE;C;30;FTE;;
End Sub

This is the module that I created

From the code that chat gpt gave me

does'nt work
Hi, Martin,
Try asking ChatGPT this: "How to add a layer with properties using VBA in IntelliCAD?"

Re: New tool to IntelliCAD : Create Construct Entities

Posted: Sat Feb 21, 2026 12:27 pm
by MARTIN L
Run-time error '429)

activex component can't create objet

This is what Chat gpt gave me :

Sub CreateLayer_FTE()

Dim icadApp As Object (this is the line in yellow) - like the error is here !!!
Dim icadDoc As Object
Dim lay As Object

Set icadApp = GetObject(, "IntelliCAD.Application")
Set icadDoc = icadApp.ActiveDocument

' Check if layer already exists
On Error Resume Next
Set lay = icadDoc.Layers.Item("FTE")
On Error GoTo 0

' If not, create it
If lay Is Nothing Then
Set lay = icadDoc.Layers.Add("FTE")
End If

' Set layer properties
lay.color = 30 ' ACI color 30
lay.Linetype = "Continuous"
lay.Lineweight = 25 ' 0.25 mm (optional)
lay.Plottable = True

icadDoc.ActiveLayer = lay

MsgBox "Layer FTE ready"

End Sub

Re: New tool to IntelliCAD : Create Construct Entities

Posted: Sun Feb 22, 2026 6:56 am
by QuanNguyen
Not sure, but maybe you mixed up the VBA and VB.

Re: New tool to IntelliCAD : Create Construct Entities

Posted: Mon Feb 23, 2026 8:42 am
by sln8458
Hi Martin,

I created a new toolbar ( L6_FTE ) then added a new tool (L6)
In the new tool, under command name I added
^C^C^C-layer;M;FTE;C;30;;;;

This works, in that it creates the new layer FTE, set the colour to 30 and then sets layer FTE to be the active layer.

There are 3 cancels (^C) as if you are in dimensions when you select the tool you could be 3 levels into the dimension command.
Plus a couple of ecxtra 'enters' to close the command.

Re: New tool to IntelliCAD : Create Construct Entities

Posted: Wed Feb 25, 2026 2:37 am
by sln8458
Here's another option:
In CUI add a keyboard shortcut ( ALT+L )
open the new shortcut
Then under Command Name add

Code: Select all

 ^-(command "-layer" "m" "FTE" "C" "30" "" "")
alt+l.png
alt+l.png (61.73 KiB) Viewed 2150 times
This does not contain the cancels ^C, I would add them if there is a chance of using this macro when another command is active.

Re: New tool to IntelliCAD : Create Construct Entities

Posted: Wed Feb 25, 2026 9:55 am
by MARTIN L
THANK YOU SO MUCH !! IT WORKS !! :D

Re: New tool to IntelliCAD : Create Construct Entities

Posted: Wed Feb 25, 2026 11:39 am
by sln8458
MARTIN L wrote:
Wed Feb 25, 2026 9:55 am
THANK YOU SO MUCH !! IT WORKS !! :D
You are welcome.