cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Help needed: MAPS

ptc-2605080
1-Newbie

Help needed: MAPS

How do SmartAssembly maps work? I've never used one before in SA, but I think I should....Do they function as a set against which something can be compared?


Thanks in advance for your help 🙂


This thread is inactive and closed by the PTC Community Management Team. If you would like to provide a reply and re-open this thread, please notify the moderator and reference the thread. You may also use "Start a topic" button to ask a new question. Please be sure to include what version of the PTC product you are using so another community member knowledgeable about your version may be able to assist.
2 REPLIES 2

Hi Geoff,



Maps are a temporary storage space for information, simliar to arrays, but with a twist.


With maps, you have to specify a data type, DOUBLE, STRING OR INTEGER (no references). Once you've specified a type, each element within a Map has two bits of information in it, the element "Key" and the element "Value".


The idea behind this structure is that you can add elements to an array (the Value) and assign a direct name for that value (the Key). With this structure, you can extract any value simply by searching the map (using the GET_MAP_ELEM command) by the key name.


For example, you could have a string map that contains different calculated values:


KEY 1390.99 22398.33


Calculated_3 23.22


Most maps are used to store vast amounts of data in them rather than smaller bits of information (like shown above). Some would argue that you can do the same thing with arrays; however, the nice thing with the map is that I can store my value against a specific key, whereas in the array, the system will store them in sequence, making it vital to know which element number contains my required value. With maps, I can simply recall the value I need against a specific key.


You can also process maps using a FOR loop; however, it is important to note that the map will be processed in alpha/numeric order (From A to Z, then 0 to infinity), or in reverse alpha/numeric order (infinity to 0, then Z to A).


Hope this helps.


Joel Beckley


Application Engineer


SIGMAXIM

Thanks, Joel, that definitely helps.


Design well!

Announcements


Top Tags