×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Are you an
Engineering professional?
Join Eng-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# Vertices selection in Workbench4

## Vertices selection in Workbench

(OP)
Dear All,
I am using ANSYS workbench Version 19.0 where ,I want to assign the "point mass" on several vertices. For this I have data of vertices in following format

X cord, Y Cord ,Z cord , mass of vertices

In order to assign mass can I select vertices based on their x,y,z location ? I have tried "Named selection"option where I have selected "scoping method"as worksheet .But it is available for x,y,z separately .It will be really helpful for me if anybody explain procedure to select the vertices for mass assignment.
Thanking you
Regards,

Regards,
sachin46

### RE: Vertices selection in Workbench

Dear sachin46,

You can add multiple rows in workbench, and then select x, y and z co-ordinates sequentially.

In case you have large number of vertices you can try using:
1. APDL commands or
2. create a single named selection of all vertices and create a point mass for single vertex manually and then object generator can be used to create point mass for all other vertices.

### RE: Vertices selection in Workbench

You can create named selection for each point using the following python code
in ACT console. Requirement is that point coordinates and masses are list of lists.
The code could be developed further by generating the point masses based on these
named selection. I tried it but was not successful in changing "scoping method" of
point masses using code.

#coordinates for each point, last item in each row is the mass
vertex_coordinates = [[0,0,0.01,10], [0,0.1,0.01,20], [0.1,0.1,0.01,30],[0.1,0,0.01,40]]

model = ExtAPI.DataModel.Project.Model
geom = model.Children[0]

for vertex in vertex_coordinates:

sel.Name = "Point"
selws = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.WorksheetSpecific)
sel.Location = selws
point_ws = sel.Location

point_ws.SetEntityType(0,NamedSelectionWorksheetEntityType.Vertex)
point_ws.SetCriterion(0,NamedSelectionWorksheetCriterion.Location_X)
point_ws.SetOperator(0,NamedSelectionWorksheetOperator.Equal)
point_ws.SetValue(0, vertex[0])

point_ws.SetAction(1,NamedSelectionWorksheetAction.Filter)
point_ws.SetEntityType(1,NamedSelectionWorksheetEntityType.Vertex)
point_ws.SetCriterion(1,NamedSelectionWorksheetCriterion.Location_Y)
point_ws.SetOperator(1,NamedSelectionWorksheetOperator.Equal)
point_ws.SetValue(1,vertex[1])

point_ws.SetAction(2,NamedSelectionWorksheetAction.Filter)
point_ws.SetEntityType(2,NamedSelectionWorksheetEntityType.Vertex)
point_ws.SetCriterion(2,NamedSelectionWorksheetCriterion.Location_Z)
point_ws.SetOperator(2,NamedSelectionWorksheetOperator.Equal)
point_ws.SetValue(2,vertex[2])

point_ws.Generate()

As previous poster said, probably the quickest way is to select the points manually and make a named selection of them and then use
object generator.

### RE: Vertices selection in Workbench

(OP)
Dear SAG8 ,
Thank you very much for your help.
I would like to know how APDL commands can be used for this.
I am new to ANSYS workbench but knows APDL very well. I will appreciate if you explain this with an example.
Thanking you.,

Regards,

Sachin46

### RE: Vertices selection in Workbench

Hi Sachin46,

I've not verified this script but hopefully it gets you close:

#### CODE --> APDL

! Assumes following arrays of dimension 'numlines' exists: 'x', 'y', 'z', 'MassOfVertices'
numlines = 1000

/prep7
alls
*get, etmax, etyp, 0, num, max
*get, rcmax, rcon, 0, num, max
et, etmax+1, 21, 0,0,2 ! mass only

type, etmax+1
*do, ct, 1, numlines
nnow = node(x(ct), y(ct), z(ct)) ! node at vertice
r, rcmax+ct, MassOfVertices(ct)  ! mass of element
real, rcmax+ct
e, nnow ! creates mass21 element
*enddo 

Kind regards,
Jason

### RE: Vertices selection in Workbench

(OP)
Dear sk_cheah,
Thank you for your reply but I am working in ANSYS workbench

### RE: Vertices selection in Workbench

Hi Sachin46,

Sorry, I should have added that the above script may be used as an APDL command snippet in Ansys Workbench. Example animation below:

Kind regards,
Jason

### RE: Vertices selection in Workbench

2
The following python code will create point masses from a file "coordinates.txt"
which is located in the user_files folder of the current ansys project. In the
example columns are separated by tab. The columns are x,y,z and mass.

https://www.dropbox.com/s/qh1kps9t3fhjhfj/pointmas...

### RE: Vertices selection in Workbench

(OP)
Dear L_K,
Thank you very much for your help.
I have created "coordinate.txt"file in folder named "user_files" and run code which is given by you in ACT console.
But i got error message "EOL while scanning single-quoted string".Please check following screen shots for your reference.

Kindly help on above error
Thanking you

Regards,
SACHIN46

### RE: Vertices selection in Workbench

The picture is a bit fuzzy. Is the last row missing parenthesis in the end?

### RE: Vertices selection in Workbench

(OP)
even if I put parenthesis for last sentence it is showing same error.Please check following image

### RE: Vertices selection in Workbench

I just tested the code in 17.2 and it worked in Windows 7. Are you by any chance on Windows 10?
Try running the code one line at a time. I suspect defining userdir variable is the cause of problem
(because of the escape character \).

### RE: Vertices selection in Workbench

#### CODE --> python

pm.Mass = Quantity(str(vertex[3])+" [kg]")

Kind regards,
Jason

### RE: Vertices selection in Workbench

Last line of the code I posted is following.
Kg is not in parenthesis.

pm.Mass = Quantity(vertex[3],'kg')

### RE: Vertices selection in Workbench

L_K

LK Your Script works fine for me. Good work. Would you please suggest any resource to learn the automation through python?(other than ACT learning material on customer portal)

Also Thumbs up to sk_cheah aka Jason. Your command on APDL is commendable.

A star for both of you.

### RE: Vertices selection in Workbench

ACT Mechanical 17.0 in portal is quite throughout. I have been able to complete
all my codes using only it and manual as a source. There are also some videos in Youtube.
If you are not already familiar with Python, Automate Boring Stuff With Python is good.

### RE: Vertices selection in Workbench

(OP)
Hi L_K ,
I got my error code is running well .Thank you very much for your help.
Only thing I am looking in code that in "named selection " location of point mass is coming under the name "Point".

It will be better if it comes as "Point 1,point 2, point 3,.......",so that for assignment of Named selection for particular point mass it will be easy. e.g. Point Mass 2 named selection such as "Point 2 "will be useful instead of "point" only.Please check following image

Thank you

### RE: Vertices selection in Workbench

There are a few options. One is to use enumerate to keep track of
the index:

for num, vertex in enumerate(coordinates, start=1):

...
sel.Name = "Point " + str(num)
...
...

pm.Name = "Point " + str(num)

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

#### Resources

White Paper â€“ Your Construction ERP RFP Checklist
Selecting business software for a medium to enterprise-sized construction concern is extremely challenging in large part because most enterprise resource planning (ERP) suites originated in the world of repetitive manufacturing and are therefore a poor fit for a project and asset-centric business. However, midsize to large contractors need the predictable, auditable processes that ERP delivers. Download Now

Close Box

# Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!