Instances translation problem.
Instances translation problem.
(OP)
I am trying to script an assembly.
So far I can import the separate parts (each of which has its own reference point) into the assembly & translate them to a specific point.
In CAE you can select a point on the instance & translate that point to a given coordinate but I have found no way of doing this via the Python API.
I can get access to an instances reference point's coordinates within the assembly easy enough with,
But when I look at the translate command it only has an instance list & an end point,
Anyone know a way of doing this?
So far I can import the separate parts (each of which has its own reference point) into the assembly & translate them to a specific point.
In CAE you can select a point on the instance & translate that point to a given coordinate but I have found no way of doing this via the Python API.
I can get access to an instances reference point's coordinates within the assembly easy enough with,
CODE --> Python
instRefCoords = mdb.models['Model-1'].rootAssembly.getCoordinates(mdb.models['Model-1'].rootAssembly.instances['TESTCASE_1-1'].referencePoints[4])
But when I look at the translate command it only has an instance list & an end point,
CODE --> Python
mdb.models['Model-1'].rootAssembly.translate(instanceList=('TESTCASE_1-1', ), vector=(endPoint)) Anyone know a way of doing this?





RE: Instances translation problem.
I think it should be easy for you to calculate the vector by yourself and then use it within the command.
RE: Instances translation problem.
Is it the vertex-centroid of the instance?
RE: Instances translation problem.
RE: Instances translation problem.
Because that will affect the position of the part once translated eg if the corner of a box was at the origin it would be translated to different place then if the box's centroid was at the origin.
RE: Instances translation problem.
That question is not correct. A instance cannot be at the orgion. Only one point of the instance could be at the origin.
Is your problem, that you don't know anything of your initial instance position at the beginning, so you don't know what translation vector is necessary?
RE: Instances translation problem.
RE: Instances translation problem.
Scripting requires certain consistency in the process or rules that can be applied when specific things are fulfilled.
You could check all points, edges or faces for their coordinates or center, but then you need to do something with these informations.
If that is not possible, then you can maybe split the process into a manual task and an automated task.