Hi,
I am new to editpythonscript.
I would like to ask if someone could help me to write a code how to draw a simple rectangle3d dynamically using editpythonscript?
I would like to replicate the command rectangle using 3 points.
This command dynamically draws rectangle while adding points.
Hello Tom,
Have you tried the Rhino Python primer 101 ? It is very good.
It is also worth doing a basic online introduction to Python course to get used to the syntax, looping, etc.
Python is very powerful and relatively easy to get started with.
It is as simple as this:
import rhinoscriptsyntax as rs
rect = rs.GetRectangle(2)
if rect:
for i, corner in enumerate(rect):
rs.AddTextDot( i, corner )
2 Likes
Thanks it solves the problem I have.
I have more questions.
I would like to ask how can I temporary display additional line of rectangle that indicates the normal of it?
By normal, I mean the line that is derived from cross-product of first two segments.
I would like to see the line while it is drawn :
And once it is drawn it would disappear:
I see that rectangle is the default Rhino method from this rhinocommon method:
Rhino.Input.RhinoGet.GetRectangle(mode, base_point, prompts)
import Rhino
import Rhino.UI
import utility as rhutil
import scriptcontext
import System.Drawing.Color
import System.Enum
import System.Array
import Eto.Forms
import System.Windows.Forms
import math
from view import __viewhelper
def BrowseForFolder(folder=None, message=None, title=None):
"""Display browse-for-folder dialog allowing the user to select a folder
Parameters:
folder (str, optional): a default folder
message (str, optional): a prompt or message
title (str, optional): a dialog box title
Returns:
This file has been truncated. show original
But I cannot find any information in the primer or elsewhere how to alter the display while drawing
Gijs
(Gijs de Zwart)
July 21, 2019, 9:11pm
5
you need a display conduit. for example:
Hi @Tom_Holt , you can only do this using a custom GetPoint
but not using GetRectangle
. See if below example helps.
DrawRectangleDisplayNormal.py (2.2 KB)
_
c.