Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X
Hi PTC Community,
I recently put a topic in here asking for any Smart Asssembly tutorial, the responses said that there was no tutorial and it was in my best bet to contact the software provider (Sigmaxim) to learn it. I am unable though to shed such a huge amount for training. So I have taken the task of learning it on my own by reading their admin guide.
I deviced my own problem and tried to solve it.
Here is my problem.
Problem Summary
Automate the process of generating tower assemblies(made of individual shells) of different heights
Problem Description
I have a tower assy which is just a simple collection (4 in nos) of hollow shells arranged one over the other. I want the user to input the total height of the tower he wants. Then I will check with the existing tower height and if it is same just regenerate and present the model. If it is not, I want to modify the individual shell heights to achieve the total height of the tower.
I tried running the following program. I don't know if I am doing this right, there are lots of errors. Please guide me in solving this which would help me in my learning.
Program
BEGIN-ASM_DESC
USER_INPUT_PARAM INTEGER HEIGHT_INPUT
COPY REF THIS TOWER
SEARCH_MDL_REF TOWER FEATURE "TOTAL_HEIGHT"
IF "TOTAL_HEIGHT" = "HEIGHT_INPUT"
REGEN_MDL TOWER
ELSE
SEARCH_MDL_REF SHELL FEATURE "SHELL_HEIGHT"
"SHELL_HEIGHT" = "HEIGHT/4"
REGEN_MDL SHELL
REGEN_MDL TOWER
END_ASM_DESCR
Regards
Charles
Yeah, there are a lot of problems with that code. I would suggest you start simple and figure out how to use one command at a time and then build from there. It also helps to look at code other people have written. Sigmaxim has some sample apps you can download from their website (assuming you have maintenance.)
Some comments on your code:
If you upload your assembly, I can try to whip something up that does what you're attempting here.
Thanks for the reply.
I have been trying to learn codes using the syntax but it seems an arduous task as the admin guide is not clear enough. Coud you help me by linking to some codes written by other people (blog or something)?
Now coming to the code, based on your suggestion I have changed the following
* COPY_REF code to GET_CURRENT_MDL and that line passed without error.
* Removed the quotes around variables.
* The feature here is the measure analysis I have done in the assy (Total height of the assy), so I guess I have to get the feature (in this case the measured height) and compare it to the user input total height.
* I got the reference of shell into the program by using the GET_CURRENT_MDL
Here is my revised version
BEGIN-ASM_DESC
USER_INPUT_PARAM INTEGER HEIGHT_INPUT
GET_CURRENT_MDL TOWER
USER_SELECT_FEATURE "Total Height"
IF TOTAL_HEIGHT == HEIGHT_INPUT
PRINT "This is your model"
ELSE
GET_CURRENT_MDL SHELL
SET_DIM_VALUE SHELL_HEIGHT = (HEIGHT_INPUT/4)
REGEN_MDL SHELL
REGEN_MDL TOWER
END_ASM_DESCR
Now the program is running without any error but the it is not regenerating the model with the new dimensions.
The printed message is this
Part "Tower" not changed since last regen.
It is not regenerating a new tower with modified height even if I give a different height
While I try to create new component, it is showing error in Line 4 (SEARCH_MDL_REF TOWER FEATURE TOTAL_HEIGHT). I wonder why Smart Assembly doesn't say what exactly is the problem with my code.
I am unable to share the files as it is a standalone system without any internet connections and that is how people in here want it to be.
Thanks for your help.
(Edited after posting)