Automated Grouping in 2D
Hi Everyone,
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 ?
Best regards,
Stefan
Hi Stefan
What you are looking for is geomObj_3 in the attached script. It is obtained via GetInPlace() command:
geomObj_3 = geompy.GetInPlace(Shaft, Circle)
St.Michael
Hi Michael,
thanx for your suggestion. My solution is now:
listSubShapeIDs = geompy.SubShapeAllIDs(Shaft, geompy.ShapeType["EDGE"])
geomObj_save = geompy.GetInPlace(Shaft, Circle)
IDs = []
IDs.append(geompy.SubShapeAll(geomObj_save, geompy.ShapeType["EDGE"]))
flatList = [item for sublist in IDs for item in sublist]
cS = geompy.CreateGroup(Shaft, geompy.ShapeType["EDGE"])
geompy.UnionList(cS, flatList)
Best wiches
Stefan
