Jump to content


Help to add an icon for a User Defined Button


6 replies to this topic

#1 john wang

    Member

  • Members
  • PipPip
  • 10 posts

Posted 13 January 2022 - 11:20 AM

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: tb.jpg


#2 Artemio

    Advanced Member

  • Administrators
  • 323 posts

Posted 15 January 2022 - 06:45 PM

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/

#3 john wang

    Member

  • Members
  • PipPip
  • 10 posts

Posted 17 January 2022 - 12:05 PM

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?

#4 Artemio

    Advanced Member

  • Administrators
  • 323 posts

Posted 17 January 2022 - 06:52 PM

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.

#5 john wang

    Member

  • Members
  • PipPip
  • 10 posts

Posted 18 January 2022 - 12:15 PM

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: f.jpg


#6 john wang

    Member

  • Members
  • PipPip
  • 10 posts

Posted 22 January 2022 - 01:35 AM

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: car.jpg


#7 john wang

    Member

  • Members
  • PipPip
  • 10 posts

Posted 22 January 2022 - 01:46 AM

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>






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users