Author Topic: Toolbar icon  (Read 6193 times)

0 Members and 1 Guest are viewing this topic.

Andrea

  • Water Moccasin
  • Posts: 2372
Toolbar icon
« on: September 08, 2011, 10:54:27 AM »
Hi all,...

any one have a idea where I can found the ACAD menu toolbar icon ?
I mean,...the bmp ?

thanks.
Keep smile...

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Toolbar icon
« Reply #1 on: September 08, 2011, 11:02:07 AM »
What's the toolbar icon?
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

BlackBox

  • King Gator
  • Posts: 3770
Re: Toolbar icon
« Reply #2 on: September 08, 2011, 11:41:11 AM »
Do you mean the AutoCAD "Menu Browser" icon?  :?

If so, open acadres.dll with a resource tool (like the one attached), and navigate to the size you want:

Large (MENUBAR = 1, and/or RIBBONSTATE = 1)
Bitmap --> 145 --> 1033

Small (MENUBAR = 0, and RIBBONSTATE = 0)
Bitmap --> 176 --> 1033

Edit: Separately, this is how I replace the default splash images also.
"How we think determines what we do, and what we do determines what we get."

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Toolbar icon
« Reply #3 on: September 08, 2011, 05:27:08 PM »
oops..ok sorry I wasn't clear anough..

When a new CUIX is created, you can retreive the bmp images located in the CUIX by renaming the file with ZIP extension..
than, browse in it and extract the file needed.

Then, i'm trying to extract the image from the acad.cuix,...but there is no bmp image in the file.
so, i'm trying to understand where those images are located to extract them.

I know reshacker, but i've wrote my routine in LISP.

Thanks for your usual help.
« Last Edit: September 08, 2011, 05:30:53 PM by Andrea »
Keep smile...

Crank

  • Water Moccasin
  • Posts: 1503
Re: Toolbar icon
« Reply #4 on: September 09, 2011, 01:41:45 AM »
You know, you can still use .dll's ?  That's exactly what's Autodesk does for their own .cuix (as already pointed out by Renderman). Surprisingly the .dll of the Acad.cuix isn't named Acad.dll , but acadres.dll. For your own .cuix the name of the .dll must be the same as your .cuix. If the icons are in a .dll, you don't have to mention the extension in your .cuix
I also believe the icons of AutoCAD are also not in the .bmp format, but .ico , but I could be wrong about this.
So you don't find icons in the acad.cuix because there are other methods to store them.

The problem with .bmp or .ico files in the .cuix are that when you want to replace or modify an icon and you recompile the menu, the icon version that's already in the .cuix always takes precedence for the version that is in the search path set in options.
I think this is a design error. Now you have to: unzip the .cuix , replace the icon and zip again
Vault Professional 2023     +     AEC Collection

Chris

  • Swamp Rat
  • Posts: 547
Re: Toolbar icon
« Reply #5 on: September 09, 2011, 08:25:09 AM »
I think this is a design error. Now you have to: unzip the .cuix , replace the icon and zip again
I thought you could use the cui editor to upload these things, instead of doing it manually?  But I could be wrong, we only had one set of icons, and havent changed them vary often.  It sounds like Andrea wants to programatically transfer the icon location I dont know how to do that from a .dll, unless you reshack them in advance and just save the icon somewhere accessible to the lisp program.
Christopher T. Cowgill, P.E.
AEC Collection 2020 (C3D)
Win 10

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Toolbar icon
« Reply #6 on: September 09, 2011, 10:55:42 AM »
thank you guys,..i'll try to find a solution with dll.

there is why i'm asking....
I've developped a lisp who extract all required information from menus and toolbars and than,...
create an HTML showing the result. So it seem to work for custum cuix,..but I can not extract the image from the acad.cuix because there's no images. when i'll find the way, i'll let you know how.
screenshot:
Keep smile...

BlackBox

  • King Gator
  • Posts: 3770
Re: Toolbar icon
« Reply #7 on: September 09, 2011, 11:03:55 AM »
Andrea, that "extractor" you're using to populate the HTML looks sa-weet.  :-)

... You wouldn't want to share it, would you...?  :-D
"How we think determines what we do, and what we do determines what we get."

Crank

  • Water Moccasin
  • Posts: 1503
Re: Toolbar icon
« Reply #8 on: September 09, 2011, 11:35:18 AM »
I thought you could use the cui editor to upload these things, instead of doing it manually?
Yes, that's possible, but only for the icons that you create with the build-in editor.
That editor is very limited, so I use ArtIcons to create my icons. I could live with replacing the icons through the editor if it would be possible to paste an image there, but this doesn't work. :x

The best solution would be if the icon location of options would take precedence of the version in the .cuix. That would make things a lot easier: You can use your own editor, make changes etc. without extracting the files.
Vault Professional 2023     +     AEC Collection

BlackBox

  • King Gator
  • Posts: 3770
Re: Toolbar icon
« Reply #9 on: September 09, 2011, 11:47:00 AM »
The CUI Editor is lacking, especially with regard to the Icon Editor... It only allows the user to create 16x16 BMP, even though the newer interfaces support 64x64 and larger (especially for the Ribbon).

I've also always found it interesting, the lack of documentation that AutoCAD reads the "light gray" (253,253,253) color from the color palette as "transparent." Even if you created your icons in Photoshop using the true color value, if you were to open and edit the icon even slightly in the Icon Editor, you MUST recolor the transparent parts of your icon using that "light gray" in the lower left for them to remain transparent. It's a real pain to work with.
"How we think determines what we do, and what we do determines what we get."

BlackBox

  • King Gator
  • Posts: 3770
Re: Toolbar icon
« Reply #10 on: September 09, 2011, 12:22:52 PM »
...
That editor is very limited, so I use ArtIcons to create my icons.

When working at home (something that takes place for too often), I use Photoshop on my personal computer.

However, when at the office I use Gimp (Portable) with Portable Apps (as IT will not install for me). :wink: :evil:
"How we think determines what we do, and what we do determines what we get."

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Toolbar icon
« Reply #11 on: September 09, 2011, 12:37:24 PM »
OK.....

I thought to surprise you and show you my newest,.... but I'm stuck with this dilemma.
In fact, the extraction of the menu in HTML is actually a small part of my new tool.

Since AutoCAD has introduced its new interface for editing the menus I never be able to love it.
that's why I created my own menu editor for AutoCAD containing various functions as useful as this extractor HTML, converter in an earlier version MNU, alignment of toolbars, restructuring and extraction of icons, etc ...

The project is not finished yet. is a pilot project for now.
but what I can see for now, it is more powerful and faster that the standard CUI editor.
mainly if you want to test a script or new command...or to show all your 32 custom toolbars alined and ready to print..??

to late now,...I said. ^-^
Keep smile...

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Toolbar icon
« Reply #12 on: September 13, 2011, 01:01:47 PM »
Well,...

what i've noted....is that all ACAD icon are'nt in the same dll.
;-\

Keep smile...

GDF

  • Water Moccasin
  • Posts: 2081
Re: Toolbar icon
« Reply #13 on: September 13, 2011, 04:28:13 PM »
If you have a seperate loaded menu file, name the dll bitmap file with the same name and it will automatically be loaded. I have been doing this for ten years now and it still works. I use reshacker to create the dll bitmap file. The same applies with a mnl file like ARCH.mnl.

I also create all of my ARCH.mnu menu file from a mnu file that I have kept uptodate.

Example: ARCH.cuix and ARCH.dll and ARCh.mnl
Taken from the mnu file:

//
//   Begin ARCH ToolBars
//

////////////////////////////////////////////////////////////////////////////////////
//////// TOOLBARS //////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////
***TOOLBARS

**ARCH_ACT
[_Toolbar("ACT", _Floating, _Hide,  225,200,1)]
[_Button("Activate Open Document", ARCH_ACT, ARCH_ACT)]ACT

**ARCH_CALC-DIST
[_Toolbar("Calc-Dist Tools", _Floating, _hide,  225,200,1)]
[_Button("Calculator", ARCH_DDCALC, ARCH_DDCALC)]CALC
[_Button("Foot-Inch Trig Calc", ARCH_DDTRI, ARCH_DDTRI)]CALU
[_Button("Count Entities", ARCH_ECOUNT, ARCH_ECOUNT)]CNT
[_Button("Unit Convertor", ARCH_UNIT, ARCH_UNIT)]UNIT
[_Button("Scale Calculator", ARCH_SC, ARCH_SC)](command "start" (strcat ARCH#UTIF "ARCH_SCALE.xls"));
[_Button("Square Footage", ARCH_NA, ARCH_NA)]SF
[_Button("Angle Between Lines", ARCH_ABL, ARCH_ABL)]ABL
[_Button("Measure Distance", ARCH_DIS, ARCH_DIS)]DSU
[_Button("List Properties", ARCH_PP, ARCH_PP)]LP
« Last Edit: September 13, 2011, 04:37:13 PM by GDF »
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Toolbar icon
« Reply #14 on: March 01, 2013, 12:26:33 PM »
Well,....while I didn't have time to solve the Acad icon extracting...
I've decided to share the code like that...

maybe someone esle can finish this tool...or maybe improve-it..
or maybe some part of this code can be useful for someone..

Have a nice weekend ! :angel:

Code: [Select]

;; MenuTree
;; by: Andrea Andreetti
;; 2012

(defun c:menutree (/ $menuname $toolbars mt $menulist $menulist2 ProList $menuList $ToolBarlist_F $ToolBarlist $iconlist_F $ToolBarlist_F $MenuData $MenuDataList bmps)
(vl-load-com) 
  (setq $menulist nil
$menulist2 nil
ProList nil
$menuList nil
$ToolBarlist_F nil
$ToolBarlist nil
$iconlist_F nil
$mainlist_F nil
$ToolBarlist_F nil
$MenuData nil
$MenuDataList nil
  )

  (if (setq bmps (vl-directory-files "c:\\windows\\temp" "*.bmp" 1))
  (mapcar '(lambda (x)
(vl-file-delete (strcat "c:\\windows\\temp\\" x))
)
     bmps)
    )

(mapcar 'vl-file-delete (vl-directory-files "c:\\windows\\temp" "*.bmp" 1)) 
  (vlax-for #mg (vla-get-menugroups (vlax-get-acad-object))
    (setq $menuList nil)
    (setq $menuname (vla-get-name #mg))
    (setq _menuDATA
   (list
     (setq
       MGID (vl-prin1-to-string (nth 2 (read (strcat "(" (vl-prin1-to-string #mg) ")"))))
     )
     $menuname
     #mg
     (vla-get-Toolbars #mg)
     (vla-get-MenuFileName #mg)

   )
    )

    (setq $MenuData nil
  $MenuDataList nil
  _ToolBarDATA nil
  _iconListDATA nil
    )
    (vlax-for i (nth 3 _menuDATA)

      (setq _ToolBarDATA
     (list (setq TBID (vl-prin1-to-string (nth 2 (read (strcat "(" (vl-prin1-to-string i) ")")))))
   (vla-get-name i)
   i
     )
      )
     
      (setq _iconListDATA nil)
      (vlax-for f i
(setq _iconListDATA
       (append
_iconListDATA
(list
   (list
     (setq ICONID (vl-prin1-to-string (nth 2 (read (strcat "(" (vl-prin1-to-string f) ")")))))
     (vla-get-name f)
     f
   )
)
       )
)

      )
      (setq $MenuData (list _ToolBarDATA _iconListDATA))

      (setq $MenuDataList (append $MenuDataList (list $MenuData)))
    )
    (setq $ToolBarlist_F (append $ToolBarlist_F (list (list _menuDATA $MenuDataList))))
  )
 
(setq mt (open (setq htmlf "c:\\menuTree1.html") "w"))
(setq date (rtos (getvar 'cdate) 2 0))
(setq d1 (substr date 1 4))
(setq d2 (substr date 5 2))
(setq d3 (substr date 7 2))

(if ACET-UI-PROGRESS-DONE (ACET-UI-PROGRESS-DONE))

(setq item (length $ToolBarlist_F))
(foreach n $ToolBarlist_F
  (foreach m (cadr n)
    (setq item (1+ item))
    )
  )
 
(if acet-ui-progress (acet-ui-progress "Running..." item))
(setq item0 0) 
 
(write-line (strcat "<font size=\"3\" face=\"arial\" color=\"0\"><b>AutoCAD version: " (getvar 'acadver) "<br>Date: " d1 "-" d2 "-" d3 "</font></b>") mt) 
(foreach n $ToolBarlist_F

  (if acet-ui-progress (acet-ui-progress (setq item0 (1+ item0)))) 

 (setq Zipcui nil)
 (write-line (strcat "<br><br><font size=\"3\" face=\"arial\" color=\"blue\"><b>" (nth 1 (car n)) "</font></b><br>"
     "<font size=\"2\" face=\"arial\" color=\"grey\">" (nth 4 (car n)) "<br>") mt)
  (if (eq (strcase (vl-filename-extension (nth 4 (car n)))) ".CUIX")
(vl-file-copy (nth 4 (car n)) (setq Zipcui (strcat "c:/windows/temp/" (vl-filename-base (nth 4 (car n))) ".zip")) T)
  )
  (foreach m (cadr n)
    (if acet-ui-progress (acet-ui-progress (setq item0 (1+ item0))))
    (write-line (strcat "<font size=\"2.5\" face=\"arial\" color=\"red\">&nbsp;&nbsp;" (nth 1 (car m)) "</font><br>") mt)   
    (write-line "<font size=\"2\" face=\"arial\" color=\"8\">" mt)
    (foreach o (cadr m)
      (setq oo o)
      (write-line (strcat "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" (check4icon (nth 2 o)) (nth 1 o) "<font size=\"2\" face=\"arial\" color=\"grey\">&nbsp;&nbsp;&nbsp;" (convertMacro (vla-get-Macro (nth 2 o))) "<br></font>") mt)
      )
    (write-line "</font><br>" mt)
    )
  ) 
  (close mt)
(if ACET-UI-PROGRESS-DONE (ACET-UI-PROGRESS-DONE))
(vl-cmdf "._browser" htmlf) 
)



(defun check4icon (ico / separator)
(setq impath "")
(if
    (not (vl-catch-all-error-p
           (vl-catch-all-apply
             'vlax-invoke-method
             (list ico 'GetBitmaps 'a 'b)
             )
           )
         )
   (progn
    (vlax-invoke-method ico 'GetBitmaps 'a 'b)
    (if a
      (progn
(if (findfile a)
  (setq impath (strcat "<img src=\"" (findfile a) "\"/>"))

  (if Zipcui
    (progn
      (ExtractFileFromZip Zipcui a "c:\\windows\\temp")
      (setq impath (strcat (strcat "<img src=\"c:\\windows\\temp\\" a "\"/>")))
    )
  )
)

      )
    )
    )
  )
  impath
)



(defun ExtractFileFromZip (zipFile srcName strDest / folder fso)
(while (vl-string-search "/" zipFile)
  (setq zipfile (vl-string-subst "\\" "/" zipfile))
 ) 
  (if (member srcName (GetAllFilesInZip zipfile))
    (progn
      (setq fso (vlax-create-object "Shell.Application"))
      (setq folder (vlax-invoke fso 'NameSpace strDest))
      (vlax-invoke folder 'CopyHere (strcat zipFile "\\" srcName))
      (vlax-release-object folder)
      (vlax-release-object fso)
    )
  )
)


(defun moreinside (chkfile / cmt cnt fil its lst sbf)
  (if (= (vlax-get-property chkfile 'IsFolder) :vlax-true)
    (progn
      (setq sbf (vlax-get-property chkfile 'getfolder))
      (setq its (vlax-invoke-method sbf 'items))
      (setq cmt (vlax-get-property its 'count))
      (setq cnt 0)
      (repeat cmt
(setq fil (moreinside (vlax-invoke-method its 'item cnt)))
(setq lst (cons fil lst))
(setq cnt (1+ cnt))
)
      (vlax-release-object sbf)
      (vlax-release-object its)
      (gc)
      (cons (vla-get-name chkfile) (reverse lst))
      )
    (vla-get-name chkfile)
    )
  )


(defun GetAllFilesInZip (zipFile / count file filelist files folder fso ndx path)
  (setq path (car (fnsplitl zipFile)))
  (setq fso (vlax-create-object "Shell.Application"))
  (setq folder (vlax-invoke fso 'NameSpace zipFile))
  (setq files (vlax-invoke folder 'Items))
  (setq count (vlax-get-property files 'Count))
  (setq ndx 0)
  (repeat count
    (setq file (moreinside (vlax-invoke files 'Item ndx)))
    (setq filelist (append filelist (list file)))
    (setq ndx (1+ ndx))
    )
  (vlax-release-object folder)
  (vlax-release-object fso)
  (gc)
  filelist
  )


(defun convertMacro (macr)
  (setq mm macr)
  (foreach str '(("\003" "^c")
("\020" "^p")
("\022" "^r")
("\r\n" ";")
)

    (while (vl-string-search (car str) macr)
      (setq macr (vl-string-subst (cadr str) (car str) macr))
    )
  )
  macr
)
« Last Edit: March 03, 2013, 07:35:27 PM by Andrea »
Keep smile...