Page 1 of 1

Convert Number to Letter?

Posted: Mon May 03, 2021 3:01 pm
by MJuric
Is there any way to have a dimension number display as a corresponding letter?

I have a method for increasing the numbers sequentially on a hole pattern grid, however in the other direction the holes are marked with letters. I can use the same method connecting the array pattern to the numbers but is there a way to then convert those numbers into corresponding letters?

As an example I have a 10X10 grid pattern. 1 thru 10 are used to number the holes vertically. I have accomplished that. I can do the same thing and get 1 thru 10 horizontally but instead of 1, 2, 3 etc I want A, B, C. Can something be done with the font? Create a new font that displays A instead of 1?

Re: Convert Number to Letter?

Posted: Tue May 04, 2021 2:32 am
by Rob
To me this is an obvious candidate for a macro.
Other than that the first method that springs to mind is to make multiple individual sketches (with a,b,c...) And then use feature suppression in equations.

+1 for the font idea😄

Re: Convert Number to Letter?

Posted: Tue May 04, 2021 8:18 am
by MJuric
Rob wrote: ↑Tue May 04, 2021 2:32 am To me this is an obvious candidate for a macro.
Other than that the first method that springs to mind is to make multiple individual sketches (with a,b,c...) And then use feature suppression in equations.

+1 for the font idea😄

I'm sure this could be done with a macro but the application I'm using this in is actually a Drive works assembly model. So the macro would have to be run on a part that is part of an assembly that is being driven by Driveworks....which seems excessive.

The font idea I like for it's simplicity but then it would mean that everyone running the driveworks model would also need that font and that can sometimes be difficult.

Re: Convert Number to Letter?

Posted: Tue May 04, 2021 8:35 am
by DennisD
MJuric wrote: ↑Tue May 04, 2021 8:18 am I'm sure this could be done with a macro but the application I'm using this in is actually a Drive works assembly model. So the macro would have to be run on a part that is part of an assembly that is being driven by Driveworks....which seems excessive.

The font idea I like for it's simplicity but then it would mean that everyone running the driveworks model would also need that font and that can sometimes be difficult.
IF you can get a translated font then wouldn't that have to be selectively applied, i.e., only applied to the characters in that one dimension?

I have not used DriveWorks, but my understanding is that it is heavily grounded in Excel and the SWX Design Table functionality. I use DT's for a ton of stuff just because of the power of Excel. I find Excel functions easier to use and more extensive than the equation editor so I'll even use a DT sometimes for a part with only one configuration. In Excel there are several different ways to easily customize a numerical value to display an alpha character instead. Do you not have access to the Excel functions by using DesignWorks?

Re: Convert Number to Letter?

Posted: Tue May 04, 2021 10:19 am
by MJuric
DennisD wrote: ↑Tue May 04, 2021 8:35 am IF you can get a translated font then wouldn't that have to be selectively applied, i.e., only applied to the characters in that one dimension?
Yes, that's exactly what I was thinking.
image.png
DennisD wrote: ↑Tue May 04, 2021 8:35 am Do you not have access to the Excel functions by using DesignWorks?
Good question that I do not have the answer too. Driveworks uses a lot of Excel functionality in it but so far, at least with express, I've not run into any direct access to Excel. In fact there are several limits to Express, like not being able to use variables, that would make me think direct access to Excel is not likely. Yes, if you have some massive drawn out formula it has to ALL be in a single formula in express. Annoying to say the least but it still works....and it's free.

That being said converting this inside Excel is pretty straight forward so I wonder if I can convert right inside SW somehow.

Re: Convert Number to Letter?

Posted: Tue May 04, 2021 10:27 am
by MJuric
DennisD wrote: ↑Tue May 04, 2021 8:35 am Do you not have access to the Excel functions by using DesignWorks?
Quick Google http://help.solidworks.com/2018/english ... xpress.htm

"You can enter standard Microsoftâ„¢ Excel functions directly into the DriveWorksXpress Rule Builder dialog box."

So now I have to figure out how to make the text in the sketch equal to a formula in Driveworks.

Re: Convert Number to Letter?

Posted: Tue May 04, 2021 12:48 pm
by Rob
MJuric wrote: ↑Tue May 04, 2021 10:27 am Quick Google http://help.solidworks.com/2018/english ... xpress.htm

"You can enter standard Microsoftâ„¢ Excel functions directly into the DriveWorksXpress Rule Builder dialog box."

So now I have to figure out how to make the text in the sketch equal to a formula in Driveworks.
image.png
image.png (4.92 KiB) Viewed 2052 times
image.png
image.png (4.49 KiB) Viewed 2052 times

Re: Convert Number to Letter?

Posted: Tue May 04, 2021 12:57 pm
by AlexLachance
Are you looking for it to automatically drive itself? Library Feature could sort of do what you want, but not "automate" the switch from letter to numbers, that would be done manually in by editing the feature, similarly like you would with a weldment.

Also, Library feature might not be the best option, if you have all the letters and numbers accordingly, the library feature would become rather "heavy"

Re: Convert Number to Letter?

Posted: Tue May 04, 2021 1:40 pm
by SamSpade
I don't know if you can take anything away from this (character & number codes)


Re: Convert Number to Letter?

Posted: Tue May 04, 2021 2:26 pm
by MJuric
Rob wrote: ↑Tue May 04, 2021 12:48 pmimage.pngimage.png
The formula is actually pretty simple. I'm just not sure how to put this into Driveworks and have it drive it in the sketch of the part. I'd assume that is possible, I just haven't ever tried it.

=MID("ABCDEFGHIJKLMNOPQRSTUVWXYZ",B18,1)
image.png

Re: Convert Number to Letter?

Posted: Tue May 04, 2021 2:32 pm
by MJuric
AlexLachance wrote: ↑Tue May 04, 2021 12:57 pm Are you looking for it to automatically drive itself?
Yes.

The numbers are done by a nifty thing I found in the old forum. In your sketch you draw the line for the text and another line. You dimension that line and make it the length of the amount you want the increment to be. So 1,2,3,4 you would draw a 1 inch line. For .5,1,1.5 you would draw a .5 inch line. Make your cut. Then when you array the sketch you link the "Instance Vary" option in the array to the dimension dimensioning the line. I then tied the number to array to the number in the actual hole pattern. So now I can enter the hole pattern and the marking text automagically creates the right amount of markings and the right sequence.
image.png
image.png

Re: Convert Number to Letter?

Posted: Sat May 08, 2021 11:33 am
by jcapriotti
MJuric wrote: ↑Tue May 04, 2021 2:32 pm Yes.

The numbers are done by a nifty thing I found in the old forum. In your sketch you draw the line for the text and another line. You dimension that line and make it the length of the amount you want the increment to be. So 1,2,3,4 you would draw a 1 inch line. For .5,1,1.5 you would draw a .5 inch line. Make your cut. Then when you array the sketch you link the "Instance Vary" option in the array to the dimension dimensioning the line. I then tied the number to array to the number in the actual hole pattern. So now I can enter the hole pattern and the marking text automagically creates the right amount of markings and the right sequence.
image.png

image.png
That is a nifty trick. however you are getting onto a realm that may require the API to configure it. Our products have similar requirements and complexity and SolidWorks just can't do it OOTB. Driveworks (Full) may be able to do this, although it maybe custom there as well, not sure. We would do something like this with the API as a dynamically inserted library feature.

Re: Convert Number to Letter?

Posted: Thu Mar 28, 2024 9:32 am
by zwei
Sorry for reviving this age long thread... just stumble across this while i am trying to figure out how to convert A to 01 in Solidworks without involving macro or drivework..

Interestingly, using a design table seems to work...
Basically the design table is just to use excel equation as the equation capability in solidworks is really limited
(To convert number to letter, you will be using char() instead)

However, the design table need to be updated everytime the number/letter change...

Custom property
image.png
Design table
image.png