Automated Grouping in 2D
Automated Grouping in 2DPosted by Stefan Kunz at September 18. 2012
I have an open issue with grouping in 2D.
My study is a shaft, modeled in 2D. I partitioned the shaft-face along the axis x and y. (see Study attached)
And I refined the contact-contour (circle, describing the shaft) with a point, rotated around the z-axis.
Afterwards the shaft-contour (circle) is partitioned in many small edges.
Now I want to group this amount of small edges.
I know how to do this in the GUI: create group --> select: geometrical parts of the second shape
My second shape is therefor "Circle" (see Study attached)
Taking a look at the study-file, the IDs of the edges are listed.
In my case I do not know how many edges there will be due to varying dimensions of the shaft.
How can I do this with python scripting ? Any hint ?
Re: Automated Grouping in 2DPosted by Saint Michael at September 18. 2012
What you are looking for is geomObj_3 in the attached script. It is obtained via GetInPlace() command:
geomObj_3 = geompy.GetInPlace(Shaft, Circle)
thanx for your suggestion. My solution is now:
listSubShapeIDs = geompy.SubShapeAllIDs(Shaft, geompy.ShapeType["EDGE"])
geomObj_save = geompy.GetInPlace(Shaft, Circle)
IDs = 
flatList = [item for sublist in IDs for item in sublist]
cS = geompy.CreateGroup(Shaft, geompy.ShapeType["EDGE"])
and of course: geompy.addToStudyInFather( Shaft, cS, 'cS' )