yonta.new_document(name?, body?)
Komut: app.new_document · New document
Create a new document and make it active.
Örnek
doc = yonta.new_document("Bracket")Arayüzün yaptığı her şeyi bir betik de yapar. Bu liste uygulamanın komut kataloğundan üretilir; komut paletinin kullandığı listeyle aynıdır.
yonta modülünü uygulamanın içindeki Python konsolundan ya da bağımsız bir betikten içe aktarın. Her komut tek bir geri alma adımıdır ve makro kaydedici tarafından burada gösterilen Python çağrısı olarak kaydedilir.
? ile işaretli parametre isteğe bağlıdır. Document ve Sketch yöntemleri bir nesne üzerinden çağrılır; document parametreleri örtüktür. Aynı liste JSON olarak: commands.json.
import yonta
doc = yonta.new_document("Bracket")
sketch = doc.new_sketch(plane="XY", name="Body")
sketch.add_circle((0, 0), 20.0)
body = doc.pad(sketch, 10.0)
doc.recompute()
doc.export("bracket.step")
doc.save("bracket.yonta")
yonta.new_document(name?, body?)Komut: app.new_document · New document
Create a new document and make it active.
Örnek
doc = yonta.new_document("Bracket")yonta.open_document(path, name?, background?, copy?)Komut: app.open_document · Open document
Open a .yonta file as a new document.
Örnek
doc = yonta.open_document("bracket.yonta")yonta.close_document(document?)Komut: app.close_document · Close document
Close a document without saving.
Örnek
yonta.close_document(doc)yonta.set_active_document(document)Komut: app.set_active_document · Switch document
Make an open document the active one.
Örnek
yonta.set_active_document(doc)Document.add_object(document?, type, name?)Komut: doc.add_object · Add object
Add an object of a registered type.
Örnek
sketch = doc.add_object("yonta.sketch.sketch")Document.remove_object(document?, object)Komut: doc.remove_object · Remove object
Remove an object.
Örnek
doc.remove_object(body)Document.set_visible(document?, objects, visible)Komut: doc.set_visible · Set visible
Show or hide objects in the 3D view: one undo step, saved with the document, no recompute.
Örnek
doc.set_visible([body], False)Document.set_suppressed(document?, objects, suppressed?)Komut: doc.set_suppressed · Suppress
Suppress objects: they are not computed, each passing its base's solid through; or bring them back.
Örnek
doc.set_suppressed([body])Document.rollback(document?, object?)Komut: doc.set_rollback · Rollback
Roll the model back to an object, or forward to the end: what follows is not computed.
Örnek
doc.rollback()Document.move_object(document?, object, before?)Komut: doc.move_object · Move in tree
Move an object to another place in the model tree; a feature takes its new place in the solid chain.
Örnek
doc.move_object(body)Document.rename(document?, object, name)Komut: doc.rename · Rename
Give an object another name; links to it keep working.
Örnek
doc.rename(body, "Base")Document.set_label(document?, object, label)Komut: doc.set_label · Set label
Set the name the window shows for an object; its name in Python and the file stays.
Örnek
doc.set_label(body, "Base plate")Document.set_property(document?, object, property, value)Komut: doc.set_property · Set property
Set a property of an object.
Örnek
doc.set_property(body, "Length", 10.0)Document.add_parameter(document?, name, expression, quantity?, group?, minimum?, maximum?, comment?, before?)Komut: doc.add_parameter · Add parameter
Add a parameter to the document's table; the first one makes the table.
Örnek
doc.add_parameter("Body", expression)Document.set_parameter(document?, name, expression)Komut: doc.set_parameter · Set parameter
Give a parameter another expression; what reads it follows in the same step.
Örnek
doc.set_parameter("Body", expression)Document.edit_parameter(document?, name, quantity?, group?, minimum?, maximum?, comment?)Komut: doc.edit_parameter · Edit parameter
Change a parameter's kind, group, limits or comment.
Örnek
doc.edit_parameter("Body")Document.move_parameter(document?, name, before?)Komut: doc.move_parameter · Move parameter
Move a parameter to another place in the table.
Örnek
doc.move_parameter("Body")Document.rename_parameter(document?, old, new)Komut: doc.rename_parameter · Rename parameter
Give a parameter another name; every expression that uses it is written anew.
Örnek
doc.rename_parameter(old, new)Document.remove_parameter(document?, name, keep_values?)Komut: doc.remove_parameter · Delete parameter
Remove a parameter that nothing uses, or turn what uses it into values.
Örnek
doc.remove_parameter("Body")Document.set_expression(document?, object, property, expression)Komut: doc.set_expression · Set expression
Give a numeric property of an object an expression.
Örnek
doc.set_expression(body, "Length", expression)Document.clear_expression(document?, object, property)Komut: doc.clear_expression · Clear expression
Take a property's expression away; its last value stays.
Örnek
doc.clear_expression(body, "Length")Document.recompute(document?, background?)Komut: doc.recompute · Recompute
Recompute a document.
Örnek
doc.recompute()Document.undo(document?)Komut: doc.undo · Undo
Undo the last change of a document.
Örnek
doc.undo()Document.redo(document?)Komut: doc.redo · Redo
Redo the last undone change of a document.
Örnek
doc.redo()Document.save(document?, path?, rename?, force?)Komut: doc.save · Save
Save a document to a .yonta file.
Örnek
doc.save("bracket.yonta")Document.export(document?, path, objects?, schema?, stl_format?, unit?, resolution?, y_up?)Komut: doc.export · Export
Export solids to STEP or STL.
Örnek
doc.export("bracket.step")Document.import_step(document?, path, name?)Komut: doc.import_step · Import STEP
Import a STEP file: one solid object per root or leaf instance.
Örnek
imported = doc.import_step("housing.step")Document.copy_sketch(document?, sketch, plane?, source?, name?)Komut: doc.copy_sketch · Copy sketch
Copy a sketch, with every constraint, onto a base plane, from this document or another.
Örnek
doc.copy_sketch(sketch)Document.new_sketch(document?, plane?, support?, face?, name?)Komut: part.new_sketch · New sketch
Add a sketch on a base plane or a planar face.
Örnek
sketch = doc.new_sketch(plane="XY", name="Body")Document.pad(document?, profile?, length?, name?, through_all?, reversed?, symmetric?, side?, second_length?, extent?, up_to?, up_to_element?, offset?, profile_edge?, new_body?, support?, face?, thin?)Komut: part.pad · Pad
Extrude a closed sketch into a solid, joined to the tip solid.
Örnek
body = doc.pad(sketch, 10.0)Document.pocket(document?, profile?, length?, name?, through_all?, reversed?, symmetric?, side?, second_length?, extent?, up_to?, up_to_element?, offset?, profile_edge?, support?, face?)Komut: part.pocket · Pocket
Cut a closed sketch into the tip solid.
Örnek
body = doc.pocket(sketch, 5.0)Document.revolve(document?, profile, angle?, axis?, name?, new_body?)Komut: part.revolve · Revolve
Revolve a closed sketch about an axis, joined to the tip solid.
Örnek
body = doc.revolve(sketch, 2 * math.pi)Document.groove(document?, profile, angle?, axis?, name?)Komut: part.groove · Groove
Revolve a closed sketch about an axis and cut it from the tip solid.
Örnek
body = doc.groove(sketch, math.pi / 2)Document.fillet(document?, edges, radius?, base?, name?, sizes?, chains?)Komut: part.fillet · Fillet
Round edges of the tip solid with a radius.
Örnek
body = doc.fillet([edge], 1.0)Document.chamfer(document?, edges, size?, base?, name?, sizes?, chains?)Komut: part.chamfer · Chamfer
Bevel edges of the tip solid by a distance.
Örnek
body = doc.chamfer([edge], 0.5)Document.shell(document?, faces, thickness?, outward?, join?, base?, name?)Komut: part.shell · Shell
Hollow the tip solid to a wall, open at the chosen faces.
Örnek
doc.shell([face], thickness=4.0)Document.draft(document?, faces, angle?, neutral, neutral_element?, pull?, pull_element?, reversed?, base?, name?)Komut: part.draft · Draft
Tilt faces of the tip solid about a neutral plane, as a moulded part needs.
Örnek
body = doc.draft([face], math.radians(2.0), neutral=(body, bottom))Document.primitive(document?, kind, length?, width?, height?, radius?, radius2?, plane?, support?, face?, origin?, new_body?, name?)Komut: part.primitive · Primitive
Add a box, cylinder, sphere or cone as a solid.
Örnek
box = doc.primitive("box", length=40.0, width=20.0, height=10.0)Document.loft(document?, profiles, profile_edges?, ruled?, closed?, new_body?, name?)Komut: part.loft · Loft
Build a solid through profiles in order.
Örnek
doc.loft([sketch, upper])Document.sweep(document?, profile, path, path_edges?, frame?, transition?, profile_edge?, new_body?, name?)Komut: part.sweep · Sweep
Sweep a profile along a path into a solid.
Örnek
body = doc.sweep(profile, path)Document.mirror(document?, plane?, support?, face?, base?, name?, features?, new_body?)Komut: part.mirror · Mirror
Join the tip solid with its reflection in a plane or a planar face.
Örnek
body = doc.mirror(plane="YZ")Document.pattern_linear(document?, features, direction?, count?, spacing?, direction2?, count2?, spacing2?, length?, offset?, end_offset?, symmetric?, reversed?, skip?, base?, name?)Komut: part.pattern_linear · Linear pattern
Copy features' tools along a direction: the count includes the original.
Örnek
row = doc.pattern_linear([hole], direction="X", count=4, spacing=15.0)Document.pattern_circular(document?, features, axis?, count?, angle?, offset?, end_offset?, symmetric?, reversed?, skip?, base?, name?)Komut: part.pattern_circular · Polar pattern
Copy features' tools round an axis: the count includes the original.
Örnek
ring = doc.pattern_circular([hole], axis="Z", count=6, angle=math.radians(60.0))Document.body(document?, name?)Komut: part.body · New body
Add an empty body: the next feature with no base joins it.
Örnek
doc.body()Document.set_material(document?, objects, material?, density?)Komut: part.set_material · Material
Set the material of a body's solid (a feature's is its body's): a table material or a custom density; its mass follows.
Örnek
doc.set_material([body])Document.section_plane(document?, plane?, support?, face?, flip?, offset?, name?)Komut: part.section_plane · Section plane
Add the document's section plane on XY, XZ or YZ or on a planar face: the side its normal points to is cut away in the view; no solid changes.
Örnek
doc.section_plane()Document.boolean(document?, tools, operation?, base?, name?)Komut: part.boolean · Boolean
Fuse, cut or intersect other bodies into a body.
Örnek
doc.boolean("Body001")Document.hole(document?, profile, diameter?, depth?, through_all?, reversed?, base?, name?, type?, standard?, size?, fit?, series?, thread_length?, left_hand?, counterbore?, countersink?, tip?, tip_angle?, depth_to?, end?, support?, up_to_face?, offset?, far_counterbore?)Komut: part.hole · Hole
Drill plain holes at a sketch's points and circle centres into the tip solid.
Örnek
body = doc.hole(sketch, 3.0, 5.0)Document.datum_plane(document?, plane?, support?, face?, offset?, name?, method?, references?, angle?)Komut: part.datum_plane · Datum plane
A reference plane on a base plane or a planar face, moved by an offset.
Örnek
plane = doc.datum_plane(plane="XY", offset=10.0)Document.datum_axis(document?, axis?, support?, edge?, offset?, name?)Komut: part.datum_axis · Datum axis
A reference axis along X, Y or Z, or on a straight edge, moved by an offset.
Örnek
doc.datum_axis()Document.datum_point(document?, support?, vertex?, offset?, name?)Komut: part.datum_point · Datum point
A reference point at the origin or a vertex, moved by an offset.
Örnek
doc.datum_point()Sketch.add_line(document?, sketch, kind, coords, construction?)Komut: sketch.add_geometry · Add sketch element
Add a point, line, circle or arc to a sketch.
Örnek
line = sketch.add_line((0, 0), (10, 0))Sketch.copy(document?, sketch, geometry, offset?, angle?, center?)Komut: sketch.copy_geometry · Copy sketch elements
Copy sketch elements moved by an offset or turned about a point, with the constraints among them.
Örnek
copies = sketch.copy([line], offset=(10.0, 0.0))Sketch.add_external(document?, sketch, object, edge?, edges?)Komut: sketch.add_external · Add external geometry
Project an edge of another object into the sketch as fixed construction geometry that follows it.
Örnek
external = sketch.add_external(body, edge)Sketch.add_constraint(document?, sketch, type, first, second?, value?, value2?, third?, inner?, driving?, expression?)Komut: sketch.add_constraint · Constraint
Add a sketch constraint.
Örnek
sketch.add_constraint("coincident", (line, "end"), (other, "start"))Sketch.set_value(document?, sketch, constraint, value)Komut: sketch.set_value · Change dimension
Change a sketch dimension.
Örnek
sketch.set_value(constraint, 10.0)Sketch.set_label(document?, sketch, constraint, offset?)Komut: sketch.set_label · Move dimension label
Place a dimension's label away from its default place; dragging a label does this.
Örnek
sketch.set_label(constraint)Sketch.set_expression(document?, sketch, constraint, expression)Komut: sketch.set_expression · Set dimension expression
Give a driving dimension an expression.
Örnek
sketch.set_expression(constraint, expression)Sketch.clear_expression(document?, sketch, constraint)Komut: sketch.clear_expression · Clear dimension expression
Take a dimension's expression away; its last value stays.
Örnek
sketch.clear_expression(constraint)Sketch.set_driving(document?, sketch, constraint, driving)Komut: sketch.set_driving · Reference dimension
Make a dimension a reference dimension, which measures and is never solved for, or a driving one again.
Örnek
sketch.set_driving(constraint, False)Sketch.move(document?, sketch, ref, to, grab?)Komut: sketch.move · Drag
Drag a point or an element within its constraints; no constraint is added or removed.
Örnek
sketch.move((line, "end"), (25.0, 5.0))Sketch.set_construction(document?, sketch, geometry, on)Komut: sketch.set_construction · Construction geometry
Make elements construction geometry, which guides and constrains but is never part of a profile, or normal geometry again.
Örnek
sketch.set_construction([line], True)Sketch.trim(document?, sketch, geometry, at)Komut: sketch.trim · Trim
Remove the piece of a line, arc or circle between the curves that cut it.
Örnek
sketch.trim(line, (16.0, 0.0))Sketch.extend(document?, sketch, geometry, end)Komut: sketch.extend · Extend
Lengthen a line or an arc from one end to the next curve ahead.
Örnek
sketch.extend(line, "end")Sketch.offset(document?, sketch, geometry, distance, constraints?)Komut: sketch.offset · Offset
Copy elements a distance away, joined where they meet and tied to their sources.
Örnek
sketch.offset([line], 2.0)Sketch.fillet(document?, sketch, corner?, geometry?, radius, constraints?)Komut: sketch.fillet · Sketch fillet
Round a sketch corner with a tangent arc; the corner's dimensions are kept.
Örnek
sketch.fillet((line, "end"), 3.0)Sketch.transform(document?, sketch, geometry, offset?, angle?, center?)Komut: sketch.transform · Move sketch elements
Move or turn sketch elements themselves, keeping their constraints.
Örnek
sketch.transform([line], angle=math.radians(90.0))Sketch.mirror(document?, sketch, geometry, axis, constraints?)Komut: sketch.mirror · Mirror sketch elements
Copy sketch elements mirrored in a line, with their constraints.
Örnek
sketch.mirror([line], other.id)Sketch.set_polygon_sides(document?, sketch, geometry, sides)Komut: sketch.set_polygon_sides · Polygon sides
Give a polygon another number of sides; its circle and its first side's constraints stay.
Örnek
sketch.set_polygon_sides(circle, 5)Sketch.remove_geometry(document?, sketch, geometry)Komut: sketch.remove_geometry · Remove sketch element
Remove a sketch element and its constraints.
Örnek
sketch.remove_geometry(line)Sketch.remove_constraint(document?, sketch, constraint)Komut: sketch.remove_constraint · Remove constraint
Remove a sketch constraint.
Örnek
sketch.remove_constraint(constraint)