Part Type Icon in Label Template #268
pe5er
started this conversation in
Ideas / Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
It would be really cool if we could add Part Type Icons to Label Templates. That would enable automatic generation of labels that look like the one below (but with vector based icons instead of images):
![](https://private-user-images.githubusercontent.com/11816726/331861307-2bf25471-647d-48e5-8d34-d1dc935a7924.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU3MDgwNjcsIm5iZiI6MTcyNTcwNzc2NywicGF0aCI6Ii8xMTgxNjcyNi8zMzE4NjEzMDctMmJmMjU0NzEtNjQ3ZC00OGU1LThkMzQtZDFkYzkzNWE3OTI0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA5MDclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwOTA3VDExMTYwN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTRjY2RkOGJhN2FjMGEzY2I4ZTBiNDQwOWQzOGEwZDFhMDRjMDQzMTJjZDI1MjM2N2Y0MGE3YmM4NmViYzUwMWEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.dplM1GxewMBQuqYHPRYK96QqZBLmGL8vMaO1FaKBIXk)
I've had a play with the code base, but I am hampered by a complete lack of C# and dot net experience, so i'm not sure i'll be able to figure out a complete solution by myself!
That gets me a Part Type Icon element that I can drag into the template editor:
![image](https://private-user-images.githubusercontent.com/11816726/331861477-d6fc330e-b8da-420b-aee6-99a5e99cb186.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU3MDgwNjcsIm5iZiI6MTcyNTcwNzc2NywicGF0aCI6Ii8xMTgxNjcyNi8zMzE4NjE0NzctZDZmYzMzMGUtYjhkYS00MjBiLWFlZTYtOTlhNWU5OWNiMTg2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA5MDclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwOTA3VDExMTYwN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWQwNGFhZjVmNjQ0MTU3OWQxOTIyZTMxZmMzMGMwOTJhYTQ5ZjJkZWI1Y2RlNDQzNzgyODg5NTQ1OTkwODM1NWUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.CU6jtPRephOqkw6Wmu2JM3YyrHNZCiF3J17FgsjaxC4)
I've added:
but when I watch partType in the debugger, it says icon is null. I was expecting this field to contain the icon's SVG data.
as a test, I created a new part type with a custom svg icon. This shows up in the PartType response. Good enough for now:
now i'm getting somewhere! next step is to convert the SVG into a graphic, and merge that with the label. For this I plan to use svg.skia.
Here's the function for converting SVGs to graphics and merging them:
and the result, very close to what I want!
Next to do is to get the aspect ratio right, and make sure the icons render correctly. They should also be black and white only, no grayscale.
Beta Was this translation helpful? Give feedback.
All reactions