←  Technical Questions

nanoCAD forum

»

Help to add an icon for a User Defined Button

john wang's Photo john wang 13 Jan 2022

Hi,

I am playing with the free version 5.0.

I created my toolbar and my command (hCH here). How do I link a icon to that button?

Regards,

John

Attached Thumbnails

  • Attached Image
Quote

Artemio's Photo Artemio 15 Jan 2022

Hi John.
Sorry, for not answering directly to your question.
Possibilities of this free version might not be enough for modern user.
In newer versions. like 21.0 etc you can add icons more easier.
For example: https://forum.nanoca...ibility-on-off/
Quote

john wang's Photo john wang 17 Jan 2022

View PostArtemio, on 15 January 2022 - 06:45 PM, said:

In newer versions. like 21.0 etc you can add icons more easier.
For example: https://forum.nanoca...ibility-on-off/

I remember it is through editing user.cfg file, but I can't find the cfg file now. Where is it stored on WIndows 10?
Quote

Artemio's Photo Artemio 17 Jan 2022

All user interface described in "nCad.cfg".
You can find it there: C:\Program Files (x86)\Nanosoft\nanoCAD en 5.0.
Also I'd recommend to read:
https://forum.nanoca...-resursnoy-dll/
and
https://habr.com/ru/...ft/blog/239533/
Can't find versions in English, sorry.
Quote

john wang's Photo john wang 18 Jan 2022

View PostArtemio, on 17 January 2022 - 06:52 PM, said:

All user interface described in "nCad.cfg".

https://forum.nanoca...-resursnoy-dll/

I have a mytest.bmp file.

mymenu.rc is:
MYTEST BITMAP "bmp\\mytest.bmp"

*Created a project named mynanomenu for .dll with VS2019

*Add mymenu.rc and mytest.bmp into the project resource

*After compiling, I got mynanomenu.dll

*Copy mynanomenu.dll into nanocad folder.

*Test my mynanomenu.dll, open nmenu.cfg, change Filet command to point to my icon like this:

[\configman\commands\fillet]
weight=i30 |cmdtype=i1 |CapsDisable = W0xFF
intername=sfillet |iconname=sSI172
BitmapDll=smynanomenu.dll
BitmapId=sMyTest

Run nanocad, I can see my icon in front of Filet command.

Attached Thumbnails

  • Attached Image
Quote

john wang's Photo john wang 22 Jan 2022

View PostArtemio, on 17 January 2022 - 06:52 PM, said:

https://habr.com/ru/...ft/blog/239533/
Can't find versions in English, sorry.

Followed this. It works. Thank you very much.

Attached Thumbnails

  • Attached Image
Quote

john wang's Photo john wang 22 Jan 2022

Make two files: BlueCar.dwg & GreenCar.dwg
Save them under C:\MyBlocks

Save below code as MyBlocks.nsf file.

In NanoCad, load this nsf file. Then there will be two new commands: BlueCar & GreenCar.

<?xml version="1.0" encoding="utf-8"?>
<package>
<command name="BlueCar" weight="30" cmdtype="1">
<script lang="VBS"><![CDATA[ 
Dim ms
Dim ut
Dim ptInsert
Set ms = ThisDrawing.ModelSpace
Set ut = ThisDrawing.Utility
ptInsert = ut.GetPoint("0,0,0", "Specify an insertion point")
ms.InsertBlock ptInsert,"C:\MyBlocks\BlueCar.dwg",1,1,1,0
]]></script>
</command>
<command name="GreenCar" weight="30" cmdtype="1">
<script lang="VBS"><![CDATA[ 
Dim ms
Dim ut
Dim ptInsert
Set ms = ThisDrawing.ModelSpace
Set ut = ThisDrawing.Utility
ptInsert = ut.GetPoint("0,0,0", "Specify an insertion point")
ms.InsertBlock ptInsert,"C:\MyBlocks\GreenCar.dwg",1,1,1,0
]]></script>
</command>
</package>
Quote