• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python utility.coercerhinoobject函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中utility.coercerhinoobject函数的典型用法代码示例。如果您正苦于以下问题:Python coercerhinoobject函数的具体用法?Python coercerhinoobject怎么用?Python coercerhinoobject使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了coercerhinoobject函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: ObjectPrintColor

def ObjectPrintColor(object_ids, color=None):
    """Returns or modifies the print color of an object
    Parameters:
      object_ids = identifiers of object(s)
      color[opt] = new print color. If omitted, the current color is returned.
    Returns:
      If color is not specified, the object's current print color
      If color is specified, the object's previous print color
      If object_ids is a list or tuple, the number of objects modified
    """
    id = rhutil.coerceguid(object_ids, False)
    if id:
        rhino_object = rhutil.coercerhinoobject(id, True, True)
        rc = rhino_object.Attributes.PlotColor
        if color:
            rhino_object.Attributes.PlotColorSource = Rhino.DocObjects.ObjectPlotColorSource.PlotColorFromObject
            rhino_object.Attributes.PlotColor = rhutil.coercecolor(color, True)
            rhino_object.CommitChanges()
            scriptcontext.doc.Views.Redraw()
        return rc
    for id in object_ids:
        color = rhutil.coercecolor(color, True)
        rhino_object = rhutil.coercerhinoobject(id, True, True)
        rhino_object.Attributes.PlotColorSource = Rhino.DocObjects.ObjectPlotColorSource.PlotColorFromObject
        rhino_object.Attributes.PlotColor = color
        rhino_object.CommitChanges()
    scriptcontext.doc.Views.Redraw()
    return len(object_ids)
开发者ID:acormier,项目名称:rhinoscriptsyntax,代码行数:28,代码来源:object.py


示例2: ObjectPrintWidthSource

def ObjectPrintWidthSource(object_ids, source=None):
    """Returns or modifies the print width source of an object
    Parameters:
      object_ids = identifiers of object(s)
      source[opt] = new print width source
        0 = print width by layer
        1 = print width by object
        3 = print width by parent
    Returns:
      If source is not specified, the object's current print width source
      If source is specified, the object's previous print width source
      If object_ids is a list or tuple, the number of objects modified
    """
    id = rhutil.coerceguid(object_ids, False)
    if id:
        rhino_object = rhutil.coercerhinoobject(id, True, True)
        rc = int(rhino_object.Attributes.PlotWeightSource)
        if source is not None:
            rhino_object.Attributes.PlotWeightSource = System.Enum.ToObject(Rhino.DocObjects.ObjectPlotWeightSource, source)
            rhino_object.CommitChanges()
            scriptcontext.doc.Views.Redraw()
        return rc
    for id in object_ids:
        rhino_object = rhutil.coercerhinoobject(id, True, True)
        rhino_object.Attributes.PlotWeightSource = System.Enum.ToObject(Rhino.DocObjects.ObjectPlotWeightSource, source)
        rhino_object.CommitChanges()
    scriptcontext.doc.Views.Redraw()
    return len(object_ids)
开发者ID:acormier,项目名称:rhinoscriptsyntax,代码行数:28,代码来源:object.py


示例3: ObjectPrintWidth

def ObjectPrintWidth(object_ids, width=None):
    """Returns or modifies the print width of an object
    Parameters:
      object_ids = identifiers of object(s)
      width[opt] = new print width value in millimeters, where width=0 means use
        the default width, and width<0 means do not print (visible for screen display,
        but does not show on print). If omitted, the current width is returned.
    Returns:
      If width is not specified, the object's current print width
      If width is specified, the object's previous print width
      If object_ids is a list or tuple, the number of objects modified
    """
    id = rhutil.coerceguid(object_ids, False)
    if id:
        rhino_object = rhutil.coercerhinoobject(id, True, True)
        rc = rhino_object.Attributes.PlotWeight
        if width is not None:
            rhino_object.Attributes.PlotWeightSource = Rhino.DocObjects.ObjectPlotWeightSource.PlotWeightFromObject
            rhino_object.Attributes.PlotWeight = width
            rhino_object.CommitChanges()
            scriptcontext.doc.Views.Redraw()
        return rc
    for id in object_ids:
        rhino_object = rhutil.coercerhinoobject(id, True, True)
        rhino_object.Attributes.PlotWeightSource = Rhino.DocObjects.ObjectPlotWeightSource.PlotWeightFromObject
        rhino_object.Attributes.PlotWeight = width
        rhino_object.CommitChanges()
    scriptcontext.doc.Views.Redraw()
    return len(object_ids)
开发者ID:acormier,项目名称:rhinoscriptsyntax,代码行数:29,代码来源:object.py


示例4: ObjectMaterialSource

def ObjectMaterialSource(object_ids, source=None):
    """Returns or modifies the rendering material source of an object.
    Parameters:
      object_ids = one or more object identifiers
      source [opt] = The new rendering material source. If omitted and a single
        object is provided in object_ids, then the current material source is
        returned. This parameter is required if multiple objects are passed in
        object_ids
        0 = Material from layer
        1 = Material from object
        3 = Material from parent
    Returns:
      If source is not specified, the current rendering material source
      If source is specified, the previous rendering material source
      If object_ids refers to multiple objects, the number of objects modified
    """
    id = rhutil.coerceguid(object_ids, False)
    if id: # working with single object
        rhino_object = rhutil.coercerhinoobject(id, True, True)
        rc = int(rhino_object.Attributes.MaterialSource)
        if source is not None:
            rhino_object.Attributes.MaterialSource = System.Enum.ToObject(Rhino.DocObjects.ObjectMaterialSource, source)
            rhino_object.CommitChanges()
        return rc
    # else working with multiple objects
    if source is None: raise Exception("source is required when object_ids represents multiple objects")
    source = System.Enum.ToObject(Rhino.DocObjects.ObjectMaterialSource, source)
    for id in object_ids:
        rhino_object = rhutil.coercerhinoobject(id, True, True)
        rhino_object.Attributes.MaterialSource = source
        rhino_object.CommitChanges()
    return len(object_ids)
开发者ID:acormier,项目名称:rhinoscriptsyntax,代码行数:32,代码来源:object.py


示例5: ObjectName

def ObjectName(object_id, name=None):
    """Returns or modifies the name of an object
    Parameters:
      object_id = id or ids of object(s)
      name[opt] = the new object name. If omitted, the current name is returned
    Returns:
      If name is not specified, the current object name
      If name is specified, the previous object name
      If object_id is a list, the number of objects changed
    """
    id = rhutil.coerceguid(object_id, False)
    rhino_object = None
    rhino_objects = None
    if id:
        rhino_object = rhutil.coercerhinoobject(id, True, True)
    else:
        rhino_objects = [rhutil.coercerhinoobject(id, True, True) for id in object_id]
        if not rhino_objects: return 0
        if len(rhino_objects)==1:
            rhino_object = rhino_objects[0]
            rhino_objects = None
    if name is None: #get the name
        if rhino_objects: raise Exception("name required when object_id represents multiple objects")
        return rhino_object.Name
    if rhino_objects:
        for rh_obj in rhino_objects:
            attr = rh_obj.Attributes
            attr.Name = name
            scriptcontext.doc.Objects.ModifyAttributes(rh_obj, attr, True)
        return len(rhino_objects)
    rc = rhino_object.Name
    if not type(name) is str: name = str(name)
    rhino_object.Attributes.Name = name
    rhino_object.CommitChanges()
    return rc
开发者ID:acormier,项目名称:rhinoscriptsyntax,代码行数:35,代码来源:object.py


示例6: ObjectLinetype

def ObjectLinetype(object_ids, linetype=None):
    """Returns of modifies the linetype of an object
    Parameters:
      object_ids = identifiers of object(s)
      linetype[opt] = name of an existing linetype. If omitted, the current
        linetype is returned. If object_ids is a list of identifiers, this parameter
        is required
    Returns:
      If a linetype is not specified, the object's current linetype
      If linetype is specified, the object's previous linetype
      If object_ids is a list, the number of objects modified
    """
    id = rhutil.coerceguid(object_ids, False)
    if id:
        rhino_object = rhutil.coercerhinoobject(id, True, True)
        oldindex = scriptcontext.doc.Linetypes.LinetypeIndexForObject(rhino_object)
        if linetype:
            newindex = scriptcontext.doc.Linetypes.Find(linetype, True)
            rhino_object.Attributes.LinetypeSource = Rhino.DocObjects.ObjectLinetypeSource.LinetypeFromObject
            rhino_object.Attributes.LinetypeIndex = newindex
            rhino_object.CommitChanges()
            scriptcontext.doc.Views.Redraw()
        return scriptcontext.doc.Linetypes[oldindex].Name

    newindex = scriptcontext.doc.Linetypes.Find(linetype, True)
    if newindex<0: raise Exception("%s does not exist in LineTypes table"%linetype)
    for id in object_ids:
        rhino_object = rhutil.coercerhinoobject(id, True, True)
        rhino_object.Attributes.LinetypeSource = Rhino.DocObjects.ObjectLinetypeSource.LinetypeFromObject
        rhino_object.Attributes.LinetypeIndex = newindex
        rhino_object.CommitChanges()
    scriptcontext.doc.Views.Redraw()
    return len(object_ids)
开发者ID:acormier,项目名称:rhinoscriptsyntax,代码行数:33,代码来源:object.py


示例7: ObjectLayer

def ObjectLayer(object_id, layer=None):
    """Returns or modifies the layer of an object
    Parameters:
      object_id = the identifier of the object(s)
      layer[opt] = name of an existing layer
    Returns:
      If a layer is not specified, the object's current layer
      If a layer is specified, the object's previous layer
      If object_id is a list or tuple, the number of objects modified
    """
    if type(object_id) is not str and hasattr(object_id, "__len__"):
        layer = __getlayer(layer, True)
        index = layer.LayerIndex
        for id in object_id:
            obj = rhutil.coercerhinoobject(id, True, True)
            obj.Attributes.LayerIndex = index
            obj.CommitChanges()
        scriptcontext.doc.Views.Redraw()
        return len(object_id)
    obj = rhutil.coercerhinoobject(object_id, True, True)
    if obj is None: return scriptcontext.errorhandler()
    index = obj.Attributes.LayerIndex
    rc = scriptcontext.doc.Layers[index].FullPath
    if layer:
        layer = __getlayer(layer, True)
        index = layer.LayerIndex
        obj.Attributes.LayerIndex = index
        obj.CommitChanges()
        scriptcontext.doc.Views.Redraw()
    return rc
开发者ID:acormier,项目名称:rhinoscriptsyntax,代码行数:30,代码来源:object.py


示例8: ObjectColorSource

def ObjectColorSource(object_ids, source=None):
    """Returns of modifies the color source of an object.
    Paramters:
      object_ids = single identifier of list of identifiers
      source[opt] = new color source
          0 = color from layer
          1 = color from object
          2 = color from material
          3 = color from parent
    Returns:
      if color source is not specified, the current color source
      is color source is specified, the previous color source
      if color_ids is a list, then the number of objects modifief
    """
    id = rhutil.coerceguid(object_ids, False)
    if id:
        rhobj = rhutil.coercerhinoobject(id, True, True)
        rc = int(rhobj.Attributes.ColorSource)
        if source is not None:
            rhobj.Attributes.ColorSource = System.Enum.ToObject(Rhino.DocObjects.ObjectColorSource, source)
            rhobj.CommitChanges()
            scriptcontext.doc.Views.Redraw()
        return rc
    else:
        rc = 0
        source = System.Enum.ToObject(Rhino.DocObjects.ObjectColorSource, source)
        for id in object_ids:
            rhobj = rhutil.coercerhinoobject(id, True, True)
            rhobj.Attributes.ColorSource = source
            rhobj.CommitChanges()
            rc += 1
        if rc: scriptcontext.doc.Views.Redraw()
        return rc
开发者ID:acormier,项目名称:rhinoscriptsyntax,代码行数:33,代码来源:object.py


示例9: ObjectLinetypeSource

def ObjectLinetypeSource(object_ids, source=None):
    """Returns of modifies the linetype source of an object
    Parameters:
      object_ids = identifiers of object(s)
      source[opt] = new linetype source. If omitted, the current source is returned.
        If object_ids is a list of identifiers, this parameter is required
          0 = By Layer
          1 = By Object
          3 = By Parent
    Returns:
      If a source is not specified, the object's current linetype source
      If source is specified, the object's previous linetype source
      If object_ids is a list, the number of objects modified
    """
    id = rhutil.coerceguid(object_ids, False)
    if id:
        rhino_object = rhutil.coercerhinoobject(id, True, True)
        oldsource = rhino_object.Attributes.LinetypeSource
        if source is not None:
            source = System.Enum.ToObject(Rhino.DocObjects.ObjectLinetypeSource, source)
            rhino_object.Attributes.LinetypeSource = source
            rhino_object.CommitChanges()
            scriptcontext.doc.Views.Redraw()
        return int(oldsource)
    source = System.Enum.ToObject(Rhino.DocObjects.ObjectLinetypeSource, source)
    for id in object_ids:
        rhino_object = rhutil.coercerhinoobject(id, True, True)
        rhino_object.Attributes.LinetypeSource = source
        rhino_object.CommitChanges()
    scriptcontext.doc.Views.Redraw()
    return len(object_ids)
开发者ID:acormier,项目名称:rhinoscriptsyntax,代码行数:31,代码来源:object.py


示例10: ObjectDescription

def ObjectDescription(object_id):
    """Returns a short text description of an object
    Parameters:
      object_id = identifier of an object
    """
    rhobj = rhutil.coercerhinoobject(object_id, True, True)
    return rhobj.ShortDescription(False)
开发者ID:acormier,项目名称:rhinoscriptsyntax,代码行数:7,代码来源:object.py


示例11: AddMaterialToObject

def AddMaterialToObject(object_id):
    """Adds material to an object and returns the new material's index. If the
    object already has a material, the the object's current material index is
    returned.
    Parameters:
      object_id = identifier of an object
    Returns:
      material index of the object
    Example:
      import rhinoscriptsyntax as rs
      obj = rs.GetObject()
      if obj:
      index = rs.ObjectMaterialIndex(obj)
    See Also:
      IsMaterialDefault
      ObjectMaterialIndex
      ObjectMaterialSource
    """
    rhino_object = rhutil.coercerhinoobject(object_id, True, True)
    attr = rhino_object.Attributes
    if attr.MaterialSource!=Rhino.DocObjects.ObjectMaterialSource.MaterialFromObject:
        attr.MaterialSource = Rhino.DocObjects.ObjectMaterialSource.MaterialFromObject
        scriptcontext.doc.Objects.ModifyAttributes(rhino_object, attr, True)
        attr = rhino_object.Attributes
    material_index = attr.MaterialIndex
    if material_index>-1: return material_index
    material_index = scriptcontext.doc.Materials.Add()
    attr.MaterialIndex = material_index
    scriptcontext.doc.Objects.ModifyAttributes(rhino_object, attr, True)
    return material_index
开发者ID:itrowa,项目名称:rhinoscriptsyntax,代码行数:30,代码来源:material.py


示例12: ObjectGripLocations

def ObjectGripLocations(object_id, points=None):
    """Returns or modifies the location of all grips owned by an object. The
    locations of the grips are returned in a list of Point3d with each position
    in the list corresponding to that grip's index. To modify the locations of
    the grips, you must provide a list of points that contain the same number
    of points at grips
    Parameters:
      object_id = identifier of the object
      points [opt] = list of 3D points identifying the new grip locations
    Returns:
      if points is not specified, the current location of all grips
      if points is specified, the previous location of all grips
      None if not successful
    """
    rhobj = rhutil.coercerhinoobject(object_id, True, True)
    if not rhobj.GripsOn: return scriptcontext.errorhandler()
    grips = rhobj.GetGrips()
    if grips is None: return scriptcontext.errorhandler()
    rc = [grip.CurrentLocation for grip in grips]
    if points and len(points)==len(grips):
        points = rhutil.coerce3dpointlist(points, True)
        for i, grip in enumerate(grips):
            point = points[i]
            grip.CurrentLocation = point
        scriptcontext.doc.Objects.GripUpdate(rhobj, True)
        scriptcontext.doc.Views.Redraw()
    return rc
开发者ID:AsherBond,项目名称:rhinopython,代码行数:27,代码来源:grips.py


示例13: PointCloudPointColors

def PointCloudPointColors(object_id, colors=[]):
    """Returns or modifies the point colors of a point cloud object
    Parameters:
      object_id: the point cloud object's identifier
      colors: list of color values if you want to adjust colors
    Returns:
      List of point cloud colors
    """
    rhobj = rhutil.coercerhinoobject(object_id)
    if rhobj:
        pc = rhobj.Geometry
    else:
        pc = rhutil.coercegeometry(object_id, True)
    if isinstance(pc, Rhino.Geometry.PointCloud):
        rc = None
        if pc.ContainsColors:
            rc = [item.Color for item in pc]
        if colors is None:
            pc.ClearColors()
        elif len(colors) == pc.Count:
            for i in range(pc.Count):
                pc[i].Color = rhutil.coercecolor(colors[i])
        if rhobj:
            rhobj.CommitChanges()
            scriptcontext.doc.Views.Redraw()
        return rc
开发者ID:howllone,项目名称:rhinopython,代码行数:26,代码来源:geometry.py


示例14: PointCloudHidePoints

def PointCloudHidePoints(object_id, hidden=[]):
    """Returns or modifies the hidden points of a point cloud object
    Parameters:
      object_id: the point cloud object's identifier
      hidden: list of hidden values if you want to hide certain points
    Returns:
      List of point cloud hidden states
    """
    rhobj = rhutil.coercerhinoobject(object_id)
    if rhobj:
        pc = rhobj.Geometry
    else:
        pc = rhutil.coercegeometry(object_id, True)
    if isinstance(pc, Rhino.Geometry.PointCloud):
        rc = None
        if pc.ContainsHiddenFlags:
            rc = [item.Hidden for item in pc]
        if hidden is None:
            pc.ClearHiddenFlags()
        elif len(hidden) == pc.Count:
            for i in range(pc.Count):
                pc[i].Hidden = hidden[i]
        if rhobj:
            rhobj.CommitChanges()
            scriptcontext.doc.Views.Redraw()
        return rc
开发者ID:howllone,项目名称:rhinopython,代码行数:26,代码来源:geometry.py


示例15: UnselectObjectGrips

def UnselectObjectGrips(object_id):
    """Unselects an object's grips. Note, the grips will not be turned off.
    Parameters:
      object_id = identifier of the object
    Returns:
      Number of grips unselected on success
      None on failure
    Example:
      import rhinoscriptsyntax as rs
      obj = rs.GetObject("Select object")
      if rs.ObjectGripsSelected(obj): rs.UnselectObjectGrips(obj)
    See Also:
      EnableObjectGrips
      ObjectGripCount
      UnselectObjectGrip
    """
    rhobj = rhutil.coercerhinoobject(object_id, True, True)
    if not rhobj.GripsOn: return scriptcontext.errorhandler()
    grips = rhobj.GetGrips()
    if grips is None: return scriptcontext.errorhandler()
    count = 0
    for grip in grips:
        if grip.Select(False)==0: count += 1
    if count>0:
        scriptcontext.doc.Views.Redraw()
        return count
    return scriptcontext.errorhandler()
开发者ID:itrowa,项目名称:rhinoscriptsyntax,代码行数:27,代码来源:grips.py


示例16: ExplodeHatch

def ExplodeHatch(hatch_id, delete=False):
    """Explodes a hatch object into its component objects. The exploded objects
    will be added to the document. If the hatch object uses a solid pattern,
    then planar face Brep objects will be created. Otherwise, line curve objects
    will be created
    Parameters:
      hatch_id = identifier of a hatch object
      delete[opt] = delete the hatch object
    Returns:
      list of identifiers for the newly created objects
      None on error
    """
    rhobj = rhutil.coercerhinoobject(hatch_id, True, True)
    pieces = rhobj.HatchGeometry.Explode()
    if not pieces: return scriptcontext.errorhandler()
    attr = rhobj.Attributes
    rc = []
    for piece in pieces:
        id = None
        if isinstance(piece, Rhino.Geometry.Curve):
            id = scriptcontext.doc.Objects.AddCurve(piece, attr)
        elif isinstance(piece, Rhino.Geometry.Brep):
            id = scriptcontext.doc.Objects.AddBrep(piece, attr)
        if id: rc.append(id)
    if delete: scriptcontext.doc.Objects.Delete(rhobj)
    return rc
开发者ID:AsherBond,项目名称:rhinopython,代码行数:26,代码来源:hatch.py


示例17: MeshToNurb

def MeshToNurb(object_id, trimmed_triangles=True, delete_input=False):
    """Duplicates each polygon in a mesh with a NURBS surface. The resulting
    surfaces are then joined into a polysurface and added to the document
    Parameters:
      object_id = identifier of a mesh object
      trimmed_triangles[opt] = if True, triangles in the mesh will be
        represented by a trimmed plane
      delete_input[opt] = delete input object
    Returns:
      list of identifiers for the new breps on success
    Example:
      import rhinoscriptsyntax as rs
      obj = rs.GetObject("Select mesh", rs.filter.mesh)
      if obj: rs.MeshToNurb(obj)
    See Also:
      IsMesh
      MeshFaces
      MeshVertices
    """
    mesh = rhutil.coercemesh(object_id, True)
    pieces = mesh.SplitDisjointPieces()
    breps = [Rhino.Geometry.Brep.CreateFromMesh(piece,trimmed_triangles) for piece in pieces]
    rhobj = rhutil.coercerhinoobject(object_id, True, True)
    attr = rhobj.Attributes
    ids = [scriptcontext.doc.Objects.AddBrep(brep, attr) for brep in breps]
    if delete_input: scriptcontext.doc.Objects.Delete(rhobj, True)
    scriptcontext.doc.Views.Redraw()
    return ids
开发者ID:itrowa,项目名称:rhinoscriptsyntax,代码行数:28,代码来源:mesh.py


示例18: HatchScale

def HatchScale(hatch_id, scale=None):
    """Returns or modifies the scale applied to the hatch pattern when it is
    mapped to the hatch's plane
    Parameters:
      hatch_id = identifier of a hatch object
      scale[opt] = scale factor
    Returns:
      if scale is not defined, the current scale factor
      if scale is defined, the previous scale factor
      None on error
    Example:
      import rhinoscriptsyntax as rs
      objects = rs.NormalObjects()
      if objects:
      for obj in objects:
      if rs.IsHatch(obj) and rs.HatchScale(obj)>1.0:
      rs.HatchScale(obj, 1.0)
    See Also:
      HatchPattern
      HatchRotation
      IsHatch
    """
    hatchobj = rhutil.coercerhinoobject(hatch_id)
    if not isinstance(hatchobj, Rhino.DocObjects.HatchObject):
        return scriptcontext.errorhandler()
    rc = hatchobj.HatchGeometry.PatternScale
    if scale and scale!=rc:
        hatchobj.HatchGeometry.PatternScale = scale
        hatchobj.CommitChanges()
        scriptcontext.doc.Views.Redraw()
    return rc
开发者ID:itrowa,项目名称:rhinoscriptsyntax,代码行数:31,代码来源:hatch.py


示例19: HatchRotation

def HatchRotation(hatch_id, rotation=None):
    """Returns or modifies the rotation applied to the hatch pattern when
    it is mapped to the hatch's plane
    Parameters:
      hatch_id = identifier of a hatch object
      rotation[opt] = rotation angle in degrees
    Returns:
      if rotation is not defined, the current rotation angle
      if rotation is specified, the previous rotation angle
      None on error
    Example:
      import rhinoscriptsyntax as rs
      objects = rs.AllObjects()
      if objects:
      for obj in objects:
      if rs.IsHatch(obj) and rs.HatchRotation(obj)>0:
      rs.HatchRotation(obj,0)
    See Also:
      AddHatch
      AddHatches
      HatchPattern
      HatchScale
      IsHatch
    """
    hatchobj = rhutil.coercerhinoobject(hatch_id, True, True)
    if not isinstance(hatchobj, Rhino.DocObjects.HatchObject):
        return scriptcontext.errorhandler()
    rc = hatchobj.HatchGeometry.PatternRotation
    rc = Rhino.RhinoMath.ToDegrees(rc)
    if rotation is not None and rotation!=rc:
        rotation = Rhino.RhinoMath.ToRadians(rotation)
        hatchobj.HatchGeometry.PatternRotation = rotation
        hatchobj.CommitChanges()
        scriptcontext.doc.Views.Redraw()
    return rc
开发者ID:itrowa,项目名称:rhinoscriptsyntax,代码行数:35,代码来源:hatch.py


示例20: HatchPattern

def HatchPattern(hatch_id, hatch_pattern=None):
    """Returns or changes a hatch object's hatch pattern
    Parameters:
      hatch_id = identifier of a hatch object
      hatch_pattern[opt] = name of an existing hatch pattern to replace the
          current hatch pattern
    Returns:
      if hatch_pattern is not specified, the current hatch pattern
      if hatch_pattern is specified, the previous hatch pattern
      None on error
    Example:
      import rhinoscriptsyntax as rs
      objects = rs.AllObjects()
      if objects is not None:
      for obj in objects:
      if rs.IsHatch(obj) and rs.HatchPattern(obj)=="Solid":
      rs.SelectObject(obj)
    See Also:
      AddHatch
      AddHatches
      HatchRotation
      HatchScale
      IsHatch
    """
    hatchobj = rhutil.coercerhinoobject(hatch_id, True, True)
    if not isinstance(hatchobj, Rhino.DocObjects.HatchObject):
        return scriptcontext.errorhandler()
    old_index = hatchobj.HatchGeometry.PatternIndex
    if hatch_pattern:
        new_index = scriptcontext.doc.HatchPatterns.Find(hatch_pattern, True)
        if new_index<0: return scriptcontext.errorhandler()
        hatchobj.HatchGeometry.PatternIndex = new_index
        hatchobj.CommitChanges()
        scriptcontext.doc.Views.Redraw()
    return scriptcontext.doc.HatchPatterns[old_index].Name
开发者ID:itrowa,项目名称:rhinoscriptsyntax,代码行数:35,代码来源:hatch.py



注:本文中的utility.coercerhinoobject函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python utility.coercexform函数代码示例发布时间:2022-05-26
下一篇:
Python utility.coerceplane函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap