#1
|
|||
|
|||
Multi language mass table
Hello,
I came across http://www.cocreateusers.org/forum/showthread.php?t=5234 but I would like to have the first row only in different languages. I tried to something like this: Code:
:contents '(((sd-multi-lang-string "Acrylic" :german "Plexiglas") 0.043 "1.190") I am using Direct Modeling v17 but I think the Version does not matter much here. |
#2
|
|||
|
|||
Re: Multi language mass table
Quote:
The issue is that the sd-multi-lang-string function needs to be evaluated when populating the field. There are a couple of ways you can do this. The first is just to use the list function rather than a quoted list, something like this: Code:
:contents (list (list (sd-multi-lang-string "Acrylic" :german "Plexiglas") 0.043 "1.190") .... ) Code:
:contents `((,(sd-multi-lang-string "Acrylic" :german "Plexiglas") 0.043 "1.190 .... )") I hope this helps! andy
__________________
Andy Poulsen AI MAXTools: Dream. Design. Done. It's that easy! Add-ins bringing new functionality and speed to Creo Elements/Direct and CoCreate products. Now available for v17-v20+! See them in action at www.ai-maxtools.com and then try them for yourself -- FREE! |
#3
|
|||
|
|||
Re: Multi language mass table
Quote:
Quote:
Another issue raises up. In the thread material density settings they write Code:
:units '( nil :lb Nil) I tried Code:
:units '( nil :kg/:m^3 Nil) |
#4
|
|||
|
|||
Re: Multi language mass table
Excellent -- thanks!
Quote:
Unit-related side note: Because Modeling doesn't automatically convert density units, I would recommend that you use a units field of nil or :number for the density field. The only reason for the units field is for automatic conversion of mass, length, and angle, as those are the units Modeling tracks. If you're not using one of those unit types in your logical table, you don't even need the :units line in your table definition. OK, so back to the issue at hand: As I mentioned above, when you create (or modify the contents of) the logical table, you will need to have it populated with the values in user units. However, since Modeling tracks density in g/mm^3, the initial specification must be done in those units. Perhaps the easiest way to do this is with the function sd-sys-to-user-units, which *does* allow you to convert density. If you want to convert in the other direction, use the function sd-user-to-sys-units. So your contents line could include something like: Code:
:contents `(("5052 Aluminum" ,(sd-sys-to-user-units :density .0027)) ("A2 Tool Steel" ,(sd-sys-to-user-units :density .007861))) I hope this helps! Please let me know if you have any questions. Thanks! andy
__________________
Andy Poulsen AI MAXTools: Dream. Design. Done. It's that easy! Add-ins bringing new functionality and speed to Creo Elements/Direct and CoCreate products. Now available for v17-v20+! See them in action at www.ai-maxtools.com and then try them for yourself -- FREE! |
#5
|
|||
|
|||
Re: Multi language mass table
Kudos to Andy! Thanks to your help I got it to work! For the record I created a minimal example:
Code:
(sd-create-logical-table "Material-Density-List" :columns '(:Material :Density) :columnNames (sd-multi-lang-string '("Material Type" "Density in g/mm^3") :german '("Werkstoff" "Dichte in g/m^3") ) :types '(:string :number) :contents (list (list (sd-multi-lang-string "Aluminum" :german "Aluminium") 0.098) (list (sd-multi-lang-string "Steel" :german "Stahl") 0.283) ) ) Quote:
I could imagine to improve the above sample with a hard coded division by 1000. So in the above example you would enter Code:
(list (sd-multi-lang-string "Aluminum" :german "Aluminium") 9.8) Last edited by papadam; 09-10-2014 at 09:41 PM. Reason: added forgotten quotes |
#6
|
|||
|
|||
Re: Multi language mass table
Quote:
Quote:
I'm curious why you removed the sd-sys-to-user-units functions, as I believe they will answer your question and solve your problem. As long as you specify the value in the code correctly, the user will see it displayed in their current units. For example, you could easily do this: Code:
:contents (list (list (sd-multi-lang-string "Aluminum" :german "Aluminium") (sd-sys-to-user-units :density 0.0027)) (list (sd-multi-lang-string "Steel" :german "Stahl") (sd-sys-to-user-units :density .007861)) ) On the other hand, if you want to display the values using a fixed set of units independent of the units the user is using (such as always displaying kg/m^3 regardless of user units), you can just do the conversion using a fixed factor as well rather than the sd-sys-to-user-units function. Perhaps that's what you were doing by not using the function. Finally, you can certainly scale the values that you're adding to the table if you want to do that. Just be sure when you use the value that you scale it in the opposite direction before using it. It's also a good idea (especially if you use units that may be different from the user's units) to make sure your column is titled appropriately to show the user what units are being used. For example, in our Volume and Mass tool, we update the titles based on the user selections (they can change the displayed unit type as part of the dialog): I hope this makes sense. Please let me know if you have more questions. Thanks! andy
__________________
Andy Poulsen AI MAXTools: Dream. Design. Done. It's that easy! Add-ins bringing new functionality and speed to Creo Elements/Direct and CoCreate products. Now available for v17-v20+! See them in action at www.ai-maxtools.com and then try them for yourself -- FREE! |
#7
|
|||
|
|||
Re: Multi language mass table
Quote:
It's a usability issue. I want to enter the values in the script using t/m^3 because this is how you have the values in mind. It creates the least leading or trailing Zeros (i.e. steel 7.8, water 1...) But this format is neither the user setting (most construction companies use kg and mm) nor the system unit setting. Quote:
Code:
(sd-create-logical-table "Material-Density-List" :columns '(:Material :Density) :columnNames (sd-multi-lang-string '("Material Type" "Density in kg/L") :german '("Werkstoff" "Dichte in kg/L") ) :types '(:string :number) :contents (list (list (sd-multi-lang-string "Aluminum" :german "Aluminium") 2.75) (list (sd-multi-lang-string "Steel" :german "Stahl") 8.5) ) ) Code:
(sd-call-cmds (set_part_base_density :parts a_TEIL :dens (/ DICHTE 1000)) |
#8
|
|||
|
|||
Re: Multi language mass table
All right! I'm glad you got it working! Lots of fun things you can do!
Good luck! andy
__________________
Andy Poulsen AI MAXTools: Dream. Design. Done. It's that easy! Add-ins bringing new functionality and speed to Creo Elements/Direct and CoCreate products. Now available for v17-v20+! See them in action at www.ai-maxtools.com and then try them for yourself -- FREE! |
#9
|
||||
|
||||
Re: Multi language mass table
Hello,
if you want, you could have a look at http://osd.cad.de/lisp_3d_08.htm try the "gdm_m1_properties.lsp" Good luck! |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|