WISH: Surface flat polygonal (for more than 4 points)


#1

There is a command in Rhino that allows to quickly draw a plan/surface polygonal? There is a command “surface from 3 or 4 points”, but there is a command that can make a surface for more points.
(every time I have to use the command “polyline” to define a space polygon and then use the command “surface from planar curves” to transform this space into a plane).
It would be interesting to introduce a command that could accelerate this situation.


#2

Hi Davide,

you can try the below script in a new toolbar button to get this command:

-_Runscript (
Option Explicit
'Script to add a planar srf from polyline

Call PlaneFromPlanarPolyline()
Sub PlaneFromPlanarPolyline()
	
	Dim arrPts, strPline, strSrf
	
	arrPts = Rhino.GetPolyline(3,,,, 3)
	If IsNull(arrPts) Then Exit Sub
	
	If Rhino.PointsAreCoplanar(arrPts) Then
		strPline = Rhino.AddPolyline(arrPts)
		If IsNull(strPline) Then Exit Sub
		strSrf = Rhino.AddPlanarSrf(Array(strPline))
		If Not IsNull(strSrf) Then 
			Rhino.DeleteObject(strPline)
		Else
			Rhino.Print "Error adding surface"
		End If
	Else
		Rhino.Print "Points must be planar"
	End If

End Sub
)

c.


#3

Hi Davide,

Something like this could easily be scriptable, in order you described.
Download the attached toolbar, and drop it into your Rhino 5.
Its single command (“PlanSrf multiple pts”) will enable you to do what you were looking for.
Remember that the command does not terminate when you create a closed boundary. You need to do that by right clicking (terminate the command)
planar_surface_multiple_points.rui (4.2 KB)

EDIT: Did not refresh the page. Sorry for posting this, Clement.


#4

no problem at all ! Have a nice weekend.

c.


#5

Thank you, it was what I wanted.
How can I do this command to associate an icon? (like the ones found on Rhino). If possible, I would like to activate it as you do with other commands in Rhino.


#6

@clement Thank you. You too.

Not sure I understood you by “activate it as you do with other commands in Rhino”?

You can add an icon in the following way:
Right click on your “Surface tools 2” toolbar, then:

A new window will appear. Change the “Appearance” from "Text only to “Image only”. Then click on “Edit”:

A new window will appear which allows you do define your icon bitmap. You can also import one.

Here is an updated version of the command. Now you do not need to close your surface, the command does that automatically for you - joins the first and the last point:
planar_surface_multiple_points2.rui (4.5 KB)


#7

just curious… is there a way to do this as a macro?

as in, i could do it for a triangle with:

_Polyline pause pause pause pause _Sellast _PlanarSrf

…but my specific question is about whether or not there’s a way to not add those pauses -or- something that tells it to wait until i leave the polyline command (which has varying amount of clicks) prior to finishing off the rest of the macro?


#8

Hi Jeff,

your macro works, but you would have to put in as many Pause commands as you would like to pick points. It does not matter if there are too many of them. One downside is that the macro doesn`t check for planarity of the polyline points (if any) and if the _PlanarSrf command actually created something.

c.


#9

Try this script
_Polyline _Persistentclose=_yes pause pause pause pause
pause pause pause pause pause pause pause pause
pause pause pause pause pause pause pause pause
pause pause pause pause pause pause pause pause
_sellast _planarsrf _delete

or the Python script:

import rhinoscriptsyntax as rs
rs.Command(" _Polyline _Persistentclose=_Yes",False)
rs.EnableRedraw(False)
crv=rs.FirstObject()
rs.AddPlanarSrf(crv)
rs.DeleteObject(crv)
rs.EnableRedraw(True)

Ciao Vittorio


#10

Thank you all.
It would be more practical to introduce this command in the new version of Rhino, as a complement to those already present. What do you think? I do not think it’s impossible …


#11

thanks. so i see there’s no WaitForCommand (or whatever) instead of entering all those pauses then :wink:


#12

true, it has been asked for, especially by @Helvetosaur in the past 100 years or so and would make macros more powerful :wink:

c.


#13

if there were a voting system for feature requests, i’d definitely vote yes on this one…
it’d be great for people like me (people that aren’t going to learn how to script) or for more one-off situations where a scripted solution would work well except the time to write it/debug it properly wouldn’t really make up for the time saved by using it only a handful of times-- where as a 4-5 command macros could be made very quickly.
any reasons given why it hasn’t been added (just curious)?


#14

Thanks for remembering…! Yeah, one of those great paradoxes of Rhino - a few commands CAN work with just one Pause for as many screen picks as you want, others (most) need one Pause per pick… I kinda gave up asking for this to be fixed a long time ago…

I think what happened here is the advent of the scripting “community” and the number of them that hang out here and supply scripts to all who ask - there are 4 on this thread alone. Based on the fact that scripted solutions are now so easily available, fixing the macro system has dropped to the lowest possible priority for McNeel…

–Mitch