I am facing the following issue: I have an INP file in which a component - including the nodes for boundary conditions - is defined using *NODE, *ELEMENT, and *NSET. I now want to combine several of these components into an assembly.
Unfortunately, simply loading the INP file is not enough; I have to move (and, if necessary, rotate) the individual components so that they are in their installation position.
In addition to placing them, I would also need to increment the names of elements and node sets; for example, “Part” should become “Part_1,” “Part_2,” and so on, and sometimes “Part_left,” “Part_right,” or similar, so that I can clearly identify which component is which later on.
What is the correct procedure for creating assemblies from individual parts?
P.S.: Sometimes I have to load and assemble a lot of parts. Is there a way to work with loops in CalculiX?
Thank you very much for your reply. So I need to assemble the assembly using CGX. I’ll take a look at that, but it’ll take me a while. I do have some experience with the CCX syntax, but I haven’t used CGX much so far.
If I understand the example correctly, you can use SETO and SETC to create new names for elements or nodes, use COPY to copy existing components, and use MOVE to move and rotate them. That would be exactly what I need.
One thing I haven’t been able to find anything about so far is loops. I can’t find anything in the examples or the help section that sounds like “for,” “while,” or “loop.” Does such a construct exist in CGX? I often find myself needing to arrange M individual parts in a circular pattern, for example, something like that would be helpful (pseudo-code):
R = 400 # radial distance
A = 100 # axial distance
N = 8 # number of radial instances
M = 3 # number of axial instances
for i in 0..(N-1):
for j in 0..(M-1):
COPY mypart mypart_{i}_{j} TRA R*cos(i*360/N) R*sin(i*360/N) A*j
If M and N are large, this kind of syntax could save a tremendous amount of manual work, but it requires that, for example, the names for COPY can also be defined using variables. I don’t know if that’s possible.
*PART, NAME=Part-1
** Node, element, section, set, surface and model feature definitions
*END PART
...
*ASSEMBLY, NAME=Assembly-1
*INSTANCE, NAME=Part-1-1, PART=Part-1
** Positioning data
** Additional set and surface definitions (optional)
*END INSTANCE
...
** Assembly-level set, surface and model feature definitions
*END ASSEMBLY
But their usage can be disabled (“Do not use parts and assemblies in input files” checkbox). Then there’s just one part and only sets can be used to distinguish individual components.
You just need a good preprocessor/mesher that will allow you to duplicate/pattern, translate and rotate mesh regions with new node and element numbers and organize them using sets to be able to operate on individual parts (assign sections, hide them and so on). PrePoMax could help with this too, unless you prefer CGX.
Unfortunately, I can’t share any INP files yet. My plan was to first enquire how assemblies can be effectively put together, and afterwards create the individual parts. The reasoning was simply that I would most likely overlook something important if I just started modeling “off the cuff,” which would then require further modifications later on.
Thanks also for the tip about the *PART keyword. It seems that this doesn’t exist in CCX. So I’ll start by learning the CGX syntax and see what I can do with it.
cgx does not have for-loops, but it has while…endwhile, which is basically equivalent, if you use valu to increase the counter. It also has if…endif. The main limitation is that valu is limited in the calculations that it can do. It supports one operation in prefix mode.
So say you want to have a dimension of 40 mm but want to use meters as units, you could use:
valu L / 40 1000
For more complex things, it is not that difficult to generate cgx code using python, for example.
In fact, in Prof. Kraska’s examples repository there is a param.py script that works as a Python preprocessor for cgx files.