How to get the control points from a Polysurface


#1

Hello all
I have a Polysurface it is from a surfase I extrude
and I want change the Length on start or end

but I have holes in so I can not scale it so I want move the control points

ist this possibel and how I get the points and move the points

Thanks Robert


#2

SolidPtOn


#3

Are you wanting to do this in a script, or is this topic mis-categorized? --Mitch


#4

how thie work in Python ?


#5

Well, as far as I know, turning on polysurface edit points is not exposed in any of the scripting interfaces. There is however a workaround - simply script rs.Command("_SolidPtOn"). The interesting thing is, that once the points are on, all of the rhinoscriptsyntax object grip manipulation methods do seem to work - you can select them, get/set their location, etc. See the rhinoscriptsyntax “grips” help section for all the methods.

One of the small quirks of any script that turns on object grips and manipulates them is that if you undo the script, the object grips will turn back on. To be lived with.

Below is a sample that gets an object’s solid editing points and scales them about the object’s bounding box center.

Beware, due to weaknesses in Rhino’s solid editing routines, randomly manipulating solid edit points can create completely crazy surfaces and potentially lock up or crash Rhino. I do not recommend editing objects this way unless you really know what you are doing. I would only try this example on a simple boxlike object. Use at your own risk.

–Mitch

"""Turns on an object's solid editing points and
scales their locations about object's bounding box center.
Beware, this script can lock up or crash Rhino!!!"""

import rhinoscriptsyntax as rs

def TestScaleObjSolidPts():
    msg="Select object to solid edit"
    obj=rs.GetObject(msg,8+16,preselect=True,select=True)
    if not obj: return
    
    sf=rs.GetReal("Scale factor for edit points?")
    if sf==None or sf<=0 :
        rs.UnselectObject(obj)
        return
    
    rs.EnableRedraw(False)
    
    #get object's solid point locations
    rs.Command("_SolidPtOn")
    grip_pts=rs.ObjectGripLocations(obj)
    
    #scale transformation by scale factor sf around object center
    bb=rs.BoundingBox(obj)
    xform=rs.XformScale(sf,(bb[0]+bb[6])/2)
    
    #transform the  points and move solid grips
    for i,pt in enumerate(grip_pts):
        new_loc=rs.PointTransform(pt,xform)
        rs.ObjectGripLocation(obj,i,new_loc)
        
    #turn off object grips
    rs.EnableObjectGrips(obj,False)
TestScaleObjSolidPts()

Export coordinates from closed polysurface using python?
#6

Thanks for help Mitch

It work I changed a bit.

#get object’s solid point locations
command = "-_SolidPtOn"
command += " _selID " + str(profil)
command += " _Enter"
rs.Command(command, True)

rs.EnableObjectGrips(profil,True)
grip_pts = rs.ObjectGripLocations(profil)

new_p =[]

for i, point in enumerate(grip_pts):
    # move or not
    if ( check_start_or_end_point(point, x_move)):
        new_x = point[0] + ( l * x_factor ) 
        new_loc = Rhino.Geometry.Point3d(new_x, point[1], point[2])
        new_p.append(new_loc)
    else:
        new_loc = Rhino.Geometry.Point3d(point[0] ,point[1], point[2])
        new_p.append(new_loc)
        
        
rs.ObjectGripLocations(profil, new_p)
rs.EnableObjectGrips(profil,False)

I my case It was a cold rolled Z_purlin with hols in .

I had some break down, but with rs.ObjectGripLocations(profil, new_p) it work pefect

Thanks Robert

.