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

Problem extruding planar surface with Rhino Python

$
0
0

@Mr_Sinter wrote:

Hi all,

i want to create a 3D Extrusion of a text element.
My script does NOT raise any errors, it just does not show me an extruded 3d Object in Rhino, the text stays a flat planar surface.....
Thanks in advance.

Greets
Mr. Sinter

Code:

    import rhinoscriptsyntax as rs
import Rhino as rhi

#CREATE TEXT AS PLANAR SRF
zero = (0,0,0)
text_guid = rs.AddText("NAME", zero, height=20.0, font="Arial")
text_in_curves = rs.ExplodeText(text_guid, delete=True)
text_as_srf = rs.AddPlanarSrf(text_in_curves)
#CREATE TEXT AS PLANAR SRF

#DELETE TEXT OUTLINE CURVES
fubar = 0
for element in text_in_curves:
 rs.DeleteObject(text_in_curves[fubar])
 fubar = fubar + 1
#DELETE TEXT OUTLINE CURVES

#CREATE EXTRUDE PATH
extrude_path = rs.AddLine((0,0,0), (0,0,10))
objectref_path = rhi.DocObjects.ObjRef(extrude_path)
path_curve = rhi.DocObjects.ObjRef.Curve(objectref_path)
#CREATE EXTRUDE PATH

#EXTRUDE SRF ALONG PATH
foo = 0
for element in text_as_srf:
 object_reference = rhi.DocObjects.ObjRef(text_as_srf[foo])
 brep_face = rhi.DocObjects.ObjRef.Face(object_reference)
 print "%s"%brep_face
 brep_extrude = rhi.Geometry.BrepFace.CreateExtrusion(brep_face, path_curve, True)
 print "%s"%brep_extrude
 foo = foo + 1
#EXTRUDE SRF ALONG PATH

#DELETE EXTRUDE PATH
rs.DeleteObject(extrude_path)

Posts: 4

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 5743

Trending Articles