Skip to content

Instantly share code, notes, and snippets.

@prantlf
Created January 15, 2021 19:01
Show Gist options
  • Save prantlf/4e6e5a99a94e4d605e189dc778d29760 to your computer and use it in GitHub Desktop.
Save prantlf/4e6e5a99a94e4d605e189dc778d29760 to your computer and use it in GitHub Desktop.
How to assign a custom icon to AutoCAD drawings.
src/icons/images/dwg.svg:
The icon image content.
src/icons/icons.css:
.binf-widgets .acad-mime-dwg {
background-image: url('images/dwg.svg');
}
src/icons/icons.js:
define([
'css!acad/icons/icons'
], function () {
return [
{
equalsNoCase: {
mime_type: [
'application/acad,',
'application/x-acad,',
'application/autocad_dwg,',
'image/x-dwg,',
'application/dwg,',
'application/x-dwg,',
'application/x-autocad,',
'image/vnd.dwg,',
'drawing/dwg'
]
},
className: 'csui-icon acad-mime-dwg',
mimeType: 'AutoCAD Drawing',
// Take precedence over the common document icon,
// which has the default sequence of 100.
sequence: 50
}
];
});
src/acad-extensions.json:
{
"csui/utils/nodesprites": {
"extensions": {
"acad": [
"acad/icons/icons"
]
}
},
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment