Personal tools
You are here: Home Forum Use Automated Grouping in 2D

Automated Grouping in 2D

Up to Use

Automated Grouping in 2D

Posted by Stefan Kunz at September 18. 2012

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

 

Attachments

Re: Automated Grouping in 2D

Posted by Saint Michael at September 18. 2012

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

Re: Automated Grouping in 2D

Posted by Stefan Kunz at September 18. 2012

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

Re: Automated Grouping in 2D

Posted by Stefan Kunz at September 18. 2012

and of course: geompy.addToStudyInFather( Shaft, cS, 'cS' )

Powered by Ploneboard
Document Actions