diff --git a/src/Mod/Sketcher/App/SketchObjectPy.xml b/src/Mod/Sketcher/App/SketchObjectPy.xml index ff6fc48cc4..d47884a050 100644 --- a/src/Mod/Sketcher/App/SketchObjectPy.xml +++ b/src/Mod/Sketcher/App/SketchObjectPy.xml @@ -11,129 +11,354 @@ FatherNamespace="Part"> - With this objects you can handle sketches + Represents a sketch object - solve the actual set of geometry and constraints + +Solve the sketch and update the geometry. + +solve() + + Returns: + 0 in case of success, otherwise the following codes in this order of + priority: + -4 if over-constrained, + -3 if conflicting constraints, + -5 if malformed constraints + -1 if solver error, + -2 if redundant constraints. + - add a geometric object to the sketch + +Add geometric objects to the sketch. + +addGeometry(geo:Geometry, isConstruction=False) -> int + Add a single geometric object to the sketch. + + Args: + geo: The geometry to add. e.g. a Part.LineSegement + isConstruction: Whether the added geometry is a "construction geometry". + Defaults to `False`, i.e. by omitting, a regular geometry is added. + + Returns: + The zero-based index of the newly added geometry. + +addGeometry(geo:List(Geometry), isConstruction=False) -> Tuple(int) + Add many geometric objects to the sketch. + + Args: + geo: The geometry to add. + isConstruction: see above. + + Returns: + A tuple of zero-based indices of all newly added geometry. + - delete a geometric object from the sketch + +Delete a geometric object from the sketch. + +delGeometry(geoId:int) + + Args: + geoId: The zero-based index of the geometry to delete. + Any internal alignment geometry thereof will be deleted, too. + - delete a list of geometric objects from the sketch, including any internal alignment geometry thereof + +Delete a list of geometric objects from the sketch. + +delGeometries(geoIds:List(int)) + + Args: + geoId: A list of zero-based indices of the geometry to delete. + Any internal alignment geometry thereof will be deleted, too. + - delete all the geometry objects and constraints from the sketch except external geometry + +Delete all the geometry objects from the sketch, except external geometry. + +deleteAllGeometry() + - delete all the constraints from the sketch + +Delete all the constraints from the sketch. + +deleteAllConstraints() + - switch a geometry to a construction line + +Toggles a geometry between regular and construction. + +toggleConstruction(geoId:int) + + Args: + geoId: The zero-based index of the geometry to toggle. + - set construction mode of a geometry on or off + +Set construction mode of a geometry. + +setConstruction(geoId:int, state:bool) + + Args: + geoId: The zero-based index of the geometry to configure. + state: `True` configures the geometry to "construction geometry", + `False` configures it to regular geometry. + - returns the construction mode of a geometry + +Determine whether the given geometry is a "construction geometry". + +getConstruction(geoId:int) + + Args: + geoId: The zero-based index of the geometry to query. + + Returns: + `True` if the geometry is "construction geometry" and + `False` if it s a regular geometry. + - add a constraint to the sketch + +Add constraints to the sketch. + +addConstraint(constraint:Constraint) -> int + Add a single constraint to the sketch and solves it. + + Returns: + The zero-based index of the newly added constraint. + +addConstraint(constraints:List(Constraint)) -> Tuple(int) + Add many constraints to the sketch without solving. + + Returns: + A tuple of zero-based indices of all newly added constraints. + - delete a constraint from the sketch + +Delete a constraint from the sketch. + +delConstraint(constraintIndex:int) + + Args: + constraintIndex: The zero-based index of the constraint to delete. + - Rename a constraint of the sketch + +Rename a constraint in the sketch. + +renameConstraint(constraintIndex:int, name:str) + + Args: + constraintIndex: The zero-based index of the constraint to rename. + name: The new name for the constraint. + An empty string makes the constraint "unnamed" again. + -Get the index of the constraint by name. -If there is no such constraint an exception is raised. +Get the index of a constraint by name. + +getIndexByName(name:str) + + Args: + name: The name for the constraint to look up. + If there is no such constraint an exception is raised. - copy another sketch's geometry and constraints + +Copy another sketch's geometry and constraints into this sketch. + +carbonCopy(objName:str, asConstruction=True) + + Args: + ObjName: The name of the sketch object to copy from. + asConstruction: Whether to copy the geometry as "construction geometry". + - add a link to an external geometry to use it in a constraint + +Add a link to an external geometry. + +addExternal(objName:str, subName:str) + + Args: + objName: The name of the document object to reference. + subName: The name of the sub-element of the object's shape to link as + "external geometry". + - delete a external geometry link from the sketch + +Delete an external geometry link from the sketch. + +delExternal(extGeoId:int) + + Args: + extGeoId: The zero-based index of the external geometry to remove. + - delete coincident constraints associated with a sketch point + +Delete coincident constraints associated with a sketch point. + +delConstraintOnPoint(vertexId:int) + + Args: + vertexId: A zero-based index of the shape's vertices. + +delConstraintOnPoint(geoId:int, pointPos:int) + + Args: + geoId: The zero-based index of the geometry that contains the point. + pointPos: Enum denoting which point on the geometry is meant: + 1: the start of a line or bounded curve. + 2: the end of a line or bounded curve. + 3: the center of a circle or ellipse. + - set the Datum of a Distance or Angle constraint + +Set the value of a datum constraint (e.g. Distance or Angle) + +setDatum(constraint, value) + + Args: + constraint (int or str): The index or name of the constraint to set. + value (float or Quantity): The value to set for the constraint. When + using floats, values for linear dimensions are interpreted as + millimeter, angular ones as radians. + - Get the value of a datum constraint + +Get the value of a datum constraint (e.g. Distance or Angle) + +getDatum(constraint) -> Quantity + + Args: + constraint (int or str): The index or name of the constraint to query. + + Returns: + The value of the constraint. + - set the Driving status of a datum constraint + +Set the Driving status of a datum constraint. + +setDriving(constraintIndex:int, state:bool) + + Args: + constraintIndex: The zero-based index of the constraint to configure. + state: `True` sets the constraint to driving, + `False` configures it as non-driving, i.e. reference. + - set the Driving status of datum constraints + +Set the Driving status of all datum constraints. + +setDatumsDriving(state:bool) + + Args: + state: `True` set all datum constraints to driving, + `False` configures them as non-driving, i.e. reference. + - Moves all datum constraints to the end of the constraint list + +Moves all datum constraints to the end of the constraint list. + +moveDatumsToEnd() + + Warning: This method reorders the constraint indices. Previously hold + numeric references to constraints may reference different constraints + after this operation. + - Get the Driving status of a datum constraint + +Get the Driving status of a datum constraint. + +getDriving(constraintIndex:int) + + Args: + constraintIndex: The zero-based index of the constraint to query. + + Returns: + `True` if the constraint is driving, + `False` if it is non-driving, i.e. reference. + - toggle the Driving status of a datum constraint + +Toggle the Driving status of a datum constraint. + +toggleDriving(constraintIndex:int) + + Args: + constraintIndex: The zero-based index of the constraint to toggle. + @@ -153,17 +378,44 @@ If there is no such constraint an exception is raised. - sets the constraint on/off (enforced or not) + +Activates or deactivates a constraint (enforce it or not). + +setActive(constraintIndex:int, state:bool) + + Args: + constraintIndex: The zero-based index of the constraint to configure. + state: `True` sets the constraint to active i.e. enforced, + `False` configures it as inactive, i.e. not enforced. + - Get the constraint status (enforced or not) + +Get whether a constraint is active, i.e. enforced, or not. + +getActive(constraintIndex:int) + + Args: + constraintIndex: The zero-based index of the constraint to query. + + Returns: + `True` if the constraint is active, i.e. enforced, + `False` if it is inactive, i.e. not enforced. + - toggle the active status of constraint (enforced or not) + +Toggle the constraint between active (enforced) and inactive. + +toggleActive(constraintIndex:int) + + Args: + constraintIndex: The zero-based index of the constraint to toggle. +