Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations MintJulep on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Instances translation problem.

Status
Not open for further replies.

DrBwts

Mechanical
Nov 4, 2012
297
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,

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,
Python:
mdb.models['Model-1'].rootAssembly.translate(instanceList=('TESTCASE_1-1', ), vector=(endPoint))

Anyone know a way of doing this?
 
Replies continue below

Recommended for you

The Scripting Reference Guide says, that the final vector is used in the command. A end point defines a vector, when the first point is the origin.

I think it should be easy for you to calculate the vector by yourself and then use it within the command.
 
My issue is when the instance is placed which part of the instance is being used as a reference as you cant pick a point with the API?

Is it the vertex-centroid of the instance?
 
It doesn't matter. The translation vector is the same for every point on the instance. There is no deformation in that process.
 
Yes but when the instance is placed at the origin which part of the instance is actually at the origin?

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.

 
Yes but when the instance is placed at the origin which part of the instance is actually at the origin?

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?
 
Then is sounds as you can't solve that with pure scripting.
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor