Create groups from vertices on semi circles (top bottom face of half cylinders)

Erik Kostson
Erik Kostson Member, Employee Posts: 200
50 Answers 100 Comments Photogenic 5 Likes
✭✭✭✭
edited May 16 in 3D Design

Say we have a half cylindrical body, with semi circle like faces on the top and bottom.
How can we then create a group of the center vertex (so vertex existing in the center of the straight line of the semi circle, as shown below)?

Answers

  • Erik Kostson
    Erik Kostson Member, Employee Posts: 200
    50 Answers 100 Comments Photogenic 5 Likes
    ✭✭✭✭
    edited May 16

    One of many possible ways is to loop through a named selection containing planar faces (e.g., semi circle capping plane/face of the half cylinder(s)), and create a group out of that center vertex.

    import math
    group = GetActiveWindow().ActiveWindow.Groups[0]
    cx=[]
    cy=[]
    cz=[]
    myv=[]
    myvIds=[]
    dist=1E12
    
    me=group.Members
    for mem in me:
        if str(mem.Shape.Geometry.GetType())=="SpaceClaim.Api.V232.Geometry.Plane":
            nwedges=mem.Edges
            for nedge in nwedges:
                if str(nedge.Shape.Geometry.GetType())=='SpaceClaim.Api.V232.Geometry.Line':
                    selections = EdgeSelection.Create(nedge)
                    a=nedge.EvalMid().Point.Position
                    cx=(a[0])
                    cy=(a[1])
                    cz=(a[2])
                    ep=nedge.GetChildren[CurvePoint]()
                    for e in ep:
                        ex=e.Position[0]
                        ey=e.Position[1]
                        ez=e.Position[2]
                        dists=math.sqrt((float(cx)-ex)**2+(float(cy)-ey)**2+(float(cz)-ez)**2)
                        if dists<dist:
                            myvs=(e)
                            dist=dists
        primarySelection = Selection.Create(myvs)
        secondarySelection = Selection.Empty()
        result = NamedSelection.Create(primarySelection, secondarySelection) 
        dist=1E12
    
    
This discussion has been closed.