Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5743

PEP-ping Python Examples

$
0
0

@ivelin.peychev wrote:

Is it just me or other also think <> in IronPython examples in RhinoCommon to be very weird looking.

I’m not a programmer but I’ve always used != and if I haven’t used DS scripting language EKL I wouldn’t have ever known what <> is.

e.g.: (I’ll skip focusing on the two space_char indentation cuz that was already discussed)
https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_DocObjects_RhinoObject_DuplicateGeometry.htm


from System import *
from Rhino import *
from Rhino.Commands import *
from Rhino.DocObjects import *
from Rhino.Input import *
from scriptcontext import doc

def RunCommand():

  rc, obj_ref = RhinoGet.GetOneObject("Select object to duplicate", False, ObjectType.AnyObject)
  if rc <> Result.Success:
    return rc
  rhino_object = obj_ref.Object()

  geometry_base = rhino_object.DuplicateGeometry()
  if geometry_base <> None:
    if doc.Objects.Add(geometry_base) <> Guid.Empty:
      doc.Views.Redraw()

  return Result.Success

if __name__ == "__main__":
  RunCommand()

Posts: 9

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 5743

Trending Articles