How to add rectangle with 2 corner point

Dear all,
I have 2 points in 3D but the Z axis are 0, I would like to draw a 2D rectangle with this 2 points of diagonal, how to use 2 diagonal to draw rectangle with python code?
thx

http://developer.rhino3d.com/api/RhinoScriptSyntax/#collapse-AddRectangle

Hi @vagrant.mouse,

Here is a simple example:

import rhinoscriptsyntax as rs

# Given these two corner points
pt0 = [5, 5, 0]
pt2 = [15, 10, 0]

# Compute the other corner points
pt1 = [pt2[0], pt0[1], 0]
pt3 = [pt0[0], pt2[1], 0]

# Create a list with all the points
rect = []
rect.append(pt0)
rect.append(pt1)
rect.append(pt2)
rect.append(pt3)
rect.append(pt0) # We want a closed polyline

# Create the rectangle
rs.AddPolyline(rect)

There are other ways of doing this too…

– Dale