Convert Number to Letter?

Use this space to ask how to do whatever you're trying to use SolidWorks to do.
MJuric
Posts: 1070
Joined: Mon Mar 08, 2021 3:21 pm
Answers: 1
x 31
x 874

Convert Number to Letter?

Unread post 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?
User avatar
Rob
Posts: 128
Joined: Mon Mar 08, 2021 3:46 pm
Answers: 2
Location: Mighty Glossop, UK
x 787
x 208
Contact:

Re: Convert Number to Letter?

Unread post 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😄
MJuric
Posts: 1070
Joined: Mon Mar 08, 2021 3:21 pm
Answers: 1
x 31
x 874

Re: Convert Number to Letter?

Unread post 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.
User avatar
DennisD
Posts: 705
Joined: Fri Mar 12, 2021 10:04 am
Answers: 1
Location: Near Jacksonville, FL
x 1028
x 1467

Re: Convert Number to Letter?

Unread post 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?
Brick walls are there for a reason. The brick walls aren't there to keep us out. The brick walls are there to show us how badly we want things.
- - -Randy Pausch
MJuric
Posts: 1070
Joined: Mon Mar 08, 2021 3:21 pm
Answers: 1
x 31
x 874

Re: Convert Number to Letter?

Unread post 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.
Attachments
image.png
MJuric
Posts: 1070
Joined: Mon Mar 08, 2021 3:21 pm
Answers: 1
x 31
x 874

Re: Convert Number to Letter?

Unread post 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.
User avatar
Rob
Posts: 128
Joined: Mon Mar 08, 2021 3:46 pm
Answers: 2
Location: Mighty Glossop, UK
x 787
x 208
Contact:

Re: Convert Number to Letter?

Unread post 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 2125 times
image.png
image.png (4.49 KiB) Viewed 2125 times
User avatar
AlexLachance
Posts: 2174
Joined: Thu Mar 11, 2021 8:14 am
Answers: 17
Location: Quebec
x 2353
x 2008

Re: Convert Number to Letter?

Unread post 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"
User avatar
SamSpade
Posts: 115
Joined: Tue Mar 23, 2021 3:34 pm
Answers: 2
Location: Montreal, QC
x 223
x 155

Re: Convert Number to Letter?

Unread post by SamSpade »

I don't know if you can take anything away from this (character & number codes)

You miss 100% of the shots you don't take - Wayne Gretzky
MJuric
Posts: 1070
Joined: Mon Mar 08, 2021 3:21 pm
Answers: 1
x 31
x 874

Re: Convert Number to Letter?

Unread post 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
MJuric
Posts: 1070
Joined: Mon Mar 08, 2021 3:21 pm
Answers: 1
x 31
x 874

Re: Convert Number to Letter?

Unread post 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
Attachments
image.png
User avatar
jcapriotti
Posts: 1852
Joined: Wed Mar 10, 2021 6:39 pm
Answers: 29
Location: The south
x 1196
x 1984

Re: Convert Number to Letter?

Unread post 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.
Jason
User avatar
zwei
Posts: 701
Joined: Mon Mar 15, 2021 9:17 pm
Answers: 18
Location: Malaysia
x 185
x 600

Re: Convert Number to Letter?

Unread post 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
Far too many items in the world are designed, constructed and foisted upon us with no understanding-or even care-for how we will use them.
Post Reply