TAGGED: scripting, spaceclaim
-
-
December 18, 2019 at 2:19 pm
Guillaume ANFOSSI
SubscriberHello,
I am looking to automate the part numbering according to their position in an assembly. My idea is to compare the alignement between local and global origin (X and Y). Could you help me to find the code in scripting ?
If you have another idea you're welcome
Thanks,
🛈 This post originally contained file attachments which have been removed in compliance with the updated Ansys Learning Forum Terms & Conditions -
December 19, 2019 at 8:28 am
Subashni Ravichandran
Ansys EmployeeHello GUICAD
I will need to consult with my team on this as I'm not an expert on scripting. I will get back to you as soon as I hear from them.
-
December 30, 2019 at 5:31 am
Subashni Ravichandran
Ansys EmployeeHello GUICAD
Sorry for the delay in response. As it was the holiday season I found it difficult to get hold of some help.
You can use commands such as "GetCoordinateSystems()" to access the coordinates of the local coordinate system (wrt global origin) of a component.
You can then create a loop to rename the components as per their coordinates as required.
Below is a sample script written by my colleague to print the coordinates. You can use it for your reference.
part =GetRootPart()
comps = part.GetAllComponents()[0]
print comps.GetName()
org = comps.GetCoordinateSystems()[0]
print org.Frame.Origin
x_coord = org.Frame.Origin[0]
y_coord = org.Frame.Origin[1]
z_coord = org.Frame.Origin[2]
print x_coord
print y_coord
print z_coord -
December 30, 2019 at 7:28 am
Guillaume ANFOSSI
SubscriberThanks
-
- You must be logged in to reply to this topic.

Boost Ansys Fluent Simulations with AWS
Computational Fluid Dynamics (CFD) helps engineers design products in which the flow of fluid components is a significant challenge. These different use cases often require large complex models to solve on a traditional workstation. Click here to join this event to learn how to leverage Ansys Fluids on the cloud, thanks to Ansys Gateway powered by AWS.

Earth Rescue – An Ansys Online Series
The climate crisis is here. But so is the human ingenuity to fight it. Earth Rescue reveals what visionary companies are doing today to engineer radical new ideas in the fight against climate change. Click here to watch the first episode.

Ansys Blog
Subscribe to the Ansys Blog to get great new content about the power of simulation delivered right to your email on a weekly basis. With content from Ansys experts, partners and customers you will learn about product development advances, thought leadership and trends and tips to better use Ansys tools. Sign up here.
-
3730
-
2570
-
1783
-
1236
-
594
© 2023 Copyright ANSYS, Inc. All rights reserved.