Sketcher: Convert XML binding files to Python API bindings model.

This commit is contained in:
tritao
2025-03-21 19:27:30 +00:00
committed by Kacper Donat
parent cab9053be8
commit 770dbe5580
16 changed files with 1524 additions and 114 deletions

View File

@@ -31,13 +31,21 @@ set(Sketcher_LIBS
)
generate_from_xml(SketchObjectSFPy)
generate_from_py_(SketchObjectSF)
generate_from_xml(SketchObjectPy)
generate_from_py_(SketchObject)
generate_from_xml(SketchGeometryExtensionPy)
generate_from_py_(SketchGeometryExtension)
generate_from_xml(ExternalGeometryExtensionPy)
generate_from_py_(ExternalGeometryExtension)
generate_from_xml(GeometryFacadePy)
generate_from_py_(GeometryFacade)
generate_from_xml(ExternalGeometryFacadePy)
generate_from_py_(ExternalGeometryFacade)
generate_from_xml(ConstraintPy)
generate_from_py_(Constraint)
generate_from_xml(SketchPy)
generate_from_py_(Sketch)
SET(Properties_SRCS

View File

@@ -0,0 +1,58 @@
from Base.Metadata import export
from Base.Persistence import Persistence
from typing import Final
@export(
Include="Mod/Sketcher/App/Constraint.h",
Constructor=True,
Delete=True,
)
class Constraint(Persistence):
"""
With this object you can handle sketches
Author: Juergen Riegel (FreeCAD@juergen-riegel.net)
Licence: LGPL
"""
Type: Final[str] = ""
"""Get the constraint type"""
First: int = 0
"""First geometry index the Constraint refers to"""
FirstPos: int = 0
"""Position of first geometry index the Constraint refers to"""
Second: int = 0
"""Second geometry index the Constraint refers to"""
SecondPos: int = 0
"""Position of second geometry index the Constraint refers to"""
Third: int = 0
"""Third geometry index the Constraint refers to"""
ThirdPos: int = 0
"""Position of third geometry index the Constraint refers to"""
Value: Final[float] = 0.0
"""Value of the Constraint"""
Name: str = ""
"""Name of the constraint"""
Driving: Final[bool] = False
"""Driving Constraint"""
InVirtualSpace: Final[bool] = False
"""Constraint in virtual space"""
IsActive: Final[bool] = False
"""Returns whether the constraint active (enforced) or not"""
LabelDistance: Final[float] = 0.0
"""Label distance"""
LabelPosition: Final[float] = 0.0
"""Label position"""

View File

@@ -0,0 +1,32 @@
from Base.Metadata import export, constmethod
from Part.App.GeometryExtension import GeometryExtension
from typing import Final, overload
@export(
PythonName="Sketcher.ExternalGeometryExtension",
Include="Mod/Sketcher/App/ExternalGeometryExtension.h",
FatherInclude="Mod/Part/App/GeometryExtensionPy.h",
Constructor=True,
)
class ExternalGeometryExtension(GeometryExtension):
"""
Describes a ExternalGeometryExtension
Author: Abdullah Tahiri (abdullah.tahiri.yo@gmail.com)
Licence: LGPL
"""
@constmethod
def testFlag(self) -> bool:
"""
Returns a boolean indicating whether the given bit is set.
"""
...
def setFlag(self) -> None:
"""
Sets the given bit to true/false.
"""
...
Ref: str = ""
"""Returns the reference string of this external geometry."""

View File

@@ -17,18 +17,18 @@
</Documentation>
<Methode Name="testFlag" Const="true">
<Documentation>
<UserDocu>returns a boolean indicating whether the given bit is set.</UserDocu>
<UserDocu>Returns a boolean indicating whether the given bit is set.</UserDocu>
</Documentation>
</Methode>
<Methode Name="setFlag" Const="false">
<Documentation>
<UserDocu>sets the given bit to true/false.</UserDocu>
<UserDocu>Sets the given bit to true/false.</UserDocu>
</Documentation>
</Methode>
<Attribute Name="Ref" ReadOnly="false">
<Documentation>
<UserDocu>
returns the reference string of this external geometry.
Returns the reference string of this external geometry.
</UserDocu>
</Documentation>
<Parameter Name="Ref" Type="String"/>

View File

@@ -0,0 +1,136 @@
from Base.Metadata import export, constmethod
from Base.BaseClass import BaseClass
from typing import Final, List
@export(
PythonName="Sketcher.ExternalGeometryFacade",
Include="Mod/Sketcher/App/ExternalGeometryFacade.h",
Constructor=True,
)
class ExternalGeometryFacade(BaseClass):
"""
Describes a GeometryFacade
Author: Abdullah Tahiri (abdullah.tahiri.yo@gmail.com)
Licence: LGPL
"""
Ref: str = ""
"""Returns the reference string of this external geometry."""
Id: int = 0
"""Sets/returns the Internal Alignment Type of the Geometry."""
Construction: bool = False
"""Sets/returns this geometry as a construction one, which will not be part of a later built shape."""
GeometryLayerId: int = 0
"""Returns the Id of the geometry Layer in which the geometry is located."""
InternalType: str = ""
"""Sets/returns the Internal Alignment Type of the Geometry."""
Blocked: bool = False
"""Sets/returns whether the geometry is blocked or not."""
Tag: Final[str] = ""
"""Gives the tag of the geometry as string."""
Geometry: object = ...
"""Returns the underlying geometry object."""
@constmethod
def testFlag(self) -> bool:
"""
Returns a boolean indicating whether the given bit is set.
"""
...
def setFlag(self) -> None:
"""
Sets the given bit to true/false.
"""
...
def mirror(self) -> None:
"""
Performs the symmetrical transformation of this geometric object
"""
...
def rotate(self) -> None:
"""
Rotates this geometric object at angle Ang (in radians) about axis
"""
...
def scale(self) -> None:
"""
Applies a scaling transformation on this geometric object with a center and scaling factor
"""
...
def transform(self) -> None:
"""
Applies a transformation to this geometric object
"""
...
def translate(self) -> None:
"""
Translates this geometric object
"""
...
@constmethod
def hasExtensionOfType(self) -> bool:
"""
Returns a boolean indicating whether a geometry extension of the type indicated as a string exists.
"""
...
@constmethod
def hasExtensionOfName(self) -> bool:
"""
Returns a boolean indicating whether a geometry extension with the name indicated as a string exists.
"""
...
@constmethod
def getExtensionOfType(self) -> object:
"""
Gets the first geometry extension of the type indicated by the string.
"""
...
@constmethod
def getExtensionOfName(self) -> object:
"""
Gets the first geometry extension of the name indicated by the string.
"""
...
def setExtension(self) -> None:
"""
Sets a geometry extension of the indicated type.
"""
...
def deleteExtensionOfType(self) -> None:
"""
Deletes all extensions of the indicated type.
"""
...
def deleteExtensionOfName(self) -> None:
"""
Deletes all extensions of the indicated name.
"""
...
@constmethod
def getExtensions(self) -> List[object]:
"""
Returns a list with information about the geometry extensions.
"""
...

View File

@@ -28,7 +28,7 @@
<Attribute Name="Ref" ReadOnly="false">
<Documentation>
<UserDocu>
Returns the reference string of this external geometry.
Returns the reference string of this external geometry.
</UserDocu>
</Documentation>
<Parameter Name="Ref" Type="String"/>
@@ -36,7 +36,7 @@
<Attribute Name="Id" ReadOnly="false">
<Documentation>
<UserDocu>
Sets/returns the Internal Alignment Type of the Geometry.
Sets/returns the Internal Alignment Type of the Geometry.
</UserDocu>
</Documentation>
<Parameter Name="Id" Type="Long"/>
@@ -50,7 +50,7 @@
<Attribute Name="GeometryLayerId" ReadOnly="false">
<Documentation>
<UserDocu>
Returns the Id of the geometry Layer in which the geometry is located.
Returns the Id of the geometry Layer in which the geometry is located.
</UserDocu>
</Documentation>
<Parameter Name="GeometryLayerId" Type="Long"/>
@@ -66,7 +66,7 @@
<Attribute Name="Blocked" ReadOnly="false">
<Documentation>
<UserDocu>
Sets/returns whether the geometry is blocked or not.
Sets/returns whether the geometry is blocked or not.
</UserDocu>
</Documentation>
<Parameter Name="Blocked" Type="Boolean"/>

View File

@@ -0,0 +1,139 @@
from Base.Metadata import export, constmethod
from Base.BaseClass import BaseClass
from Base.Axis import Axis
from Base.CoordinateSystem import CoordinateSystem
from Base.Placement import Placement
from Base.Vector import Vector
from App.DocumentObjectExtension import DocumentObjectExtension
from typing import Final, List
@export(
PythonName="Sketcher.GeometryFacade",
Include="Mod/Sketcher/App/GeometryFacade.h",
Constructor=True,
Delete=True,
)
class GeometryFacade(BaseClass):
"""
Describes a GeometryFacade
Author: Abdullah Tahiri (abdullah.tahiri.yo@gmail.com)
Licence: LGPL
"""
Id: int = ...
"""Sets/returns the Id of the SketchGeometryExtension."""
InternalType: str = ...
"""Sets/returns the Internal Alignment Type of the Geometry."""
Blocked: bool = ...
"""Sets/returns whether the geometry is blocked or not."""
Construction: bool = ...
"""Sets/returns this geometry as a construction one, which will not be part of a later built shape."""
GeometryLayerId: int = ...
"""Returns the Id of the geometry Layer in which the geometry is located."""
Tag: Final[str] = ...
"""Gives the tag of the geometry as string."""
Geometry: object = ...
"""Returns the underlying geometry object."""
@constmethod
def testGeometryMode(self) -> bool:
"""
Returns a boolean indicating whether the given bit is set.
"""
...
def setGeometryMode(self) -> None:
"""
Sets the given bit to true/false.
"""
...
def mirror(self) -> None:
"""
Performs the symmetrical transformation of this geometric object
"""
...
def rotate(self, Ang: float, axis: Axis) -> None:
"""
Rotates this geometric object at angle Ang (in radians) about axis
"""
...
def scale(self, center: CoordinateSystem, factor: float) -> None:
"""
Applies a scaling transformation on this geometric object with a center and scaling factor
"""
...
def transform(self, transformation: Placement) -> None:
"""
Applies a transformation to this geometric object
"""
...
def translate(self, offset: Vector) -> None:
"""
Translates this geometric object
"""
...
@constmethod
def hasExtensionOfType(self, type_str: str) -> bool:
"""
Returns a boolean indicating whether a geometry extension of the type indicated as a string exists.
"""
...
@constmethod
def hasExtensionOfName(self, name: str) -> bool:
"""
Returns a boolean indicating whether a geometry extension with the name indicated as a string exists.
"""
...
@constmethod
def getExtensionOfType(self, type_str: str) -> DocumentObjectExtension:
"""
Gets the first geometry extension of the type indicated by the string.
"""
...
@constmethod
def getExtensionOfName(self, name: str) -> DocumentObjectExtension:
"""
Gets the first geometry extension of the name indicated by the string.
"""
...
def setExtension(self, extension: DocumentObjectExtension) -> None:
"""
Sets a geometry extension of the indicated type.
"""
...
def deleteExtensionOfType(self, type_str: str) -> None:
"""
Deletes all extensions of the indicated type.
"""
...
def deleteExtensionOfName(self, name: str) -> None:
"""
Deletes all extensions of the indicated name.
"""
...
@constmethod
def getExtensions(self) -> List[DocumentObjectExtension]:
"""
Returns a list with information about the geometry extensions.
"""
...

View File

@@ -29,7 +29,7 @@
<Attribute Name="Id" ReadOnly="false">
<Documentation>
<UserDocu>
Sets/returns the Id of the SketchGeometryExtension.
Sets/returns the Id of the SketchGeometryExtension.
</UserDocu>
</Documentation>
<Parameter Name="Id" Type="Long"/>
@@ -37,7 +37,7 @@
<Attribute Name="InternalType" ReadOnly="false">
<Documentation>
<UserDocu>
Sets/returns the Internal Alignment Type of the Geometry.
Sets/returns the Internal Alignment Type of the Geometry.
</UserDocu>
</Documentation>
<Parameter Name="InternalType" Type="String"/>
@@ -45,7 +45,7 @@
<Attribute Name="Blocked" ReadOnly="false">
<Documentation>
<UserDocu>
Sets/returns whether the geometry is blocked or not.
Sets/returns whether the geometry is blocked or not.
</UserDocu>
</Documentation>
<Parameter Name="Blocked" Type="Boolean"/>
@@ -59,7 +59,7 @@
<Attribute Name="GeometryLayerId" ReadOnly="false">
<Documentation>
<UserDocu>
Returns the Id of the geometry Layer in which the geometry is located.
Returns the Id of the geometry Layer in which the geometry is located.
</UserDocu>
</Documentation>
<Parameter Name="GeometryLayerId" Type="Long"/>

View File

@@ -0,0 +1,72 @@
from Base.Metadata import export, constmethod
from Base.Persistence import Persistence
from Base.Vector import Vector
from typing import Final, Tuple
@export(
Include="Mod/Sketcher/App/Sketch.h",
FatherInclude="Base/PersistencePy.h",
Constructor=True,
)
class Sketch(Persistence):
"""
With this objects you can handle constraint sketches
Author: Juergen Riegel (FreeCAD@juergen-riegel.net)
Licence: LGPL
"""
Constraint: Final[int] = 0
"""0: exactly constraint, -1 under-constraint, 1 over-constraint"""
Conflicts: Final[Tuple] = ()
"""Tuple of conflicting constraints"""
Redundancies: Final[Tuple] = ()
"""Tuple of redundant constraints"""
Geometries: Final[Tuple] = ()
"""Tuple of all geometric elements in this sketch"""
Shape: Final[object] = None
"""Resulting shape from the sketch geometry"""
def solve(self) -> None:
"""
Solve the actual set of geometry and constraints
"""
...
def addGeometry(self) -> None:
"""
Add a geometric object to the sketch
"""
...
def addConstraint(self) -> None:
"""
Add an constraint object to the sketch
"""
...
def clear(self) -> None:
"""
Clear the sketch
"""
...
def moveGeometry(
self, GeoIndex: int, PointPos: Vector, Vector: Vector, relative: bool = False
) -> None:
"""
moveGeometry(GeoIndex,PointPos,Vector,[relative]) - move a given point (or curve)
to another location.
It moves the specified point (or curve) to the given location by adding some
temporary weak constraints and solve the sketch.
This method is mostly used to allow the user to drag some portions of the sketch
in real time by e.g. the mouse and it works only for underconstrained portions of
the sketch.
The argument 'relative', if present, states if the new location is given
relatively to the current one.
"""
...

View File

@@ -0,0 +1,45 @@
from Base.Metadata import export, constmethod
from Part.App.GeometryExtension import GeometryExtension
@export(
Name="SketchGeometryExtensionPy",
PythonName="Sketcher.SketchGeometryExtension",
Include="Mod/Sketcher/App/SketchGeometryExtension.h",
FatherInclude="Mod/Part/App/GeometryExtensionPy.h",
Constructor=True,
)
class SketchGeometryExtension(GeometryExtension):
"""
Describes a SketchGeometryExtension
Author: Abdullah Tahiri (abdullah.tahiri.yo@gmail.com)
Licence: LGPL
"""
Id: int = 0
"""Returns the Id of the SketchGeometryExtension."""
InternalType: str = ""
"""Returns the Id of the SketchGeometryExtension."""
Blocked: bool = False
"""Sets/returns whether the geometry is blocked or not."""
Construction: bool = False
"""Sets/returns this geometry as a construction one, which will not be part of a later built shape."""
GeometryLayerId: int = 0
"""Returns the Id of the geometry Layer in which the geometry is located."""
@constmethod
def testGeometryMode(self) -> bool:
"""
Returns a boolean indicating whether the given bit is set.
"""
...
def setGeometryMode(self) -> None:
"""
Sets the given bit to true/false.
"""
...

View File

@@ -0,0 +1,875 @@
from Base.Metadata import export, constmethod, no_args
from Base.Quantity import Quantity
from Base.Vector import Vector
from Base.Axis import Axis
from Part.App.Part2DObject import Part2DObject
from Part.App.Geometry import Geometry
from Sketcher.App.Constraint import Constraint
from typing import List, Tuple, Union, Final, overload
@export(
Include="Mod/Sketcher/App/SketchObject.h",
FatherInclude="Mod/Part/App/Part2DObjectPy.h",
)
class SketchObject(Part2DObject):
"""
Represents a sketch object
Author: Juergen Riegel
Licence: LGPL
"""
MissingPointOnPointConstraints: List = ...
"""Returns a list of (First FirstPos Second SecondPos Type) tuples with all the detected endpoint constraints."""
MissingVerticalHorizontalConstraints: List = ...
"""Returns a list of (First FirstPos Second SecondPos Type) tuples with all the detected vertical/horizontal constraints."""
MissingLineEqualityConstraints: List = ...
"""Returns a list of (First FirstPos Second SecondPos) tuples with all the detected line segment equality constraints."""
MissingRadiusConstraints: List = ...
"""Returns a list of (First FirstPos Second SecondPos) tuples with all the detected radius constraints."""
OpenVertices: Final[List] = ...
"""Returns a list of vertices positions."""
ConstraintCount: Final[int] = ...
"""Number of Constraints in this sketch"""
GeometryCount: Final[int] = ...
"""Number of geometric objects in this sketch"""
AxisCount: Final[int] = ...
"""Return the number of construction lines in the sketch which can be used as axes"""
GeometryFacadeList: List = ...
"""Return a list of GeometryFacade objects corresponding to the PropertyGeometryList"""
DoF: Final[int] = ...
"""Return the DoFs of the current solved sketch"""
ConflictingConstraints: Final[List] = ...
"""Return a list of integers indicating the constraints detected as conflicting"""
RedundantConstraints: Final[List] = ...
"""Return a list of integers indicating the constraints detected as redundant"""
PartiallyRedundantConstraints: Final[List] = ...
"""Return a list of integers indicating the constraints detected as partially redundant"""
MalformedConstraints: Final[List] = ...
"""Return a list of integers indicating the constraints detected as malformed"""
def solve(self) -> int:
"""
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.
"""
...
@overload
def addGeometry(self, geo: Geometry, isConstruction: bool = False) -> int: ...
@overload
def addGeometry(self, geo: List[Geometry], isConstruction: bool = False) -> Tuple[int, ...]: ...
def addGeometry(
self, geo: Union[Geometry, List[Geometry]], isConstruction: bool = False
) -> Union[int, Tuple[int, ...]]:
"""
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.
"""
...
def delGeometry(self, geoId: int) -> None:
"""
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.
"""
...
def delGeometries(self, geoIds: List[int]) -> None:
"""
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.
"""
...
def deleteAllGeometry(self) -> None:
"""
Delete all the geometry objects from the sketch, except external geometry.
deleteAllGeometry()
"""
...
def detectDegeneratedGeometries(self, tolerance: float) -> int:
"""
Detect degenerated geometries. A curve geometry is considered degenerated
if the parameter range is less than the tolerance.
detectDegeneratedGeometries(tolerance:float)
Args:
tolerance: The tolerance to check the parameter range of a curve.
Returns:
The number of degenerated geometries.
"""
...
def removeDegeneratedGeometries(self, tolerance: float) -> int:
"""
Remove degenerated geometries. A curve geometry is considered degenerated
if the parameter range is less than the tolerance.
removeDegeneratedGeometries(tolerance:float)
Args:
tolerance: The tolerance to check the parameter range of a curve.
Returns:
The number of degenerated geometries.
"""
...
def deleteAllConstraints(self) -> None:
"""
Delete all the constraints from the sketch.
deleteAllConstraints()
"""
...
def toggleConstruction(self, geoId: int) -> None:
"""
Toggles a geometry between regular and construction.
toggleConstruction(geoId:int)
Args:
geoId: The zero-based index of the geometry to toggle.
"""
...
def setConstruction(self, geoId: int, state: bool) -> None:
"""
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.
"""
...
def getConstruction(self, geoId: int) -> bool:
"""
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.
"""
...
@overload
def addConstraint(self, constraint: Constraint) -> int: ...
@overload
def addConstraint(self, constraints: List[Constraint]) -> Tuple[int, ...]: ...
def addConstraint(
self, constraint: Union[Constraint, List[Constraint]]
) -> Union[int, Tuple[int, ...]]:
"""
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.
"""
...
def delConstraint(self, constraintIndex: int) -> None:
"""
Delete a constraint from the sketch.
delConstraint(constraintIndex:int)
Args:
constraintIndex: The zero-based index of the constraint to delete.
"""
...
def renameConstraint(self, constraintIndex: int, name: str) -> None:
"""
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.
"""
...
@constmethod
def getIndexByName(self, name: str) -> int:
"""
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.
"""
...
def carbonCopy(self, objName: str, asConstruction: bool = True) -> None:
"""
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".
"""
...
def addExternal(
self, objName: str, subName: str, defining: bool = False, intersection: bool = False
) -> None:
"""
Add a link to an external geometry.
addExternal(objName:str, subName:str, defining:bool=False, intersection:bool=False)
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".
defining: Should the external edges be defining or construction?
intersection: Should the external edges be projections or intersections?
"""
...
def delExternal(self, extGeoId: int) -> None:
"""
Delete an external geometry link from the sketch.
delExternal(extGeoId:int)
Args:
extGeoId: The zero-based index of the external geometry to remove.
"""
...
@overload
def delConstraintOnPoint(self, vertexId: int) -> None: ...
@overload
def delConstraintOnPoint(self, geoId: int, pointPos: int) -> None: ...
def delConstraintOnPoint(self, *args: int) -> None:
"""
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.
"""
...
@no_args
def delConstraintsToExternal(self) -> None:
"""
Deletes all constraints referencing an external geometry.
"""
...
def setDatum(self, constraint: Union[int, str], value: Union[float, Quantity]) -> None:
"""
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.
"""
...
@constmethod
def getDatum(self, constraint: Union[int, str]) -> Quantity:
"""
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.
"""
...
def setDriving(self, constraintIndex: int, state: bool) -> None:
"""
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.
"""
...
def setDatumsDriving(self, state: bool) -> None:
"""
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.
"""
...
def moveDatumsToEnd(self) -> None:
"""
Moves all datum constraints to the end of the constraint list.
moveDatumsToEnd()
Warning: This method reorders the constraint indices. Previously held
numeric references to constraints may reference different constraints
after this operation.
"""
...
@constmethod
def getDriving(self, constraintIndex: int) -> bool:
"""
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.
"""
...
def toggleDriving(self, constraintIndex: int) -> None:
"""
Toggle the Driving status of a datum constraint.
toggleDriving(constraintIndex:int)
Args:
constraintIndex: The zero-based index of the constraint to toggle.
"""
...
def setVirtualSpace(self) -> None:
"""
Set the VirtualSpace status of a constraint
"""
...
def getVirtualSpace(self) -> bool:
"""
Get the VirtualSpace status of a constraint
"""
...
def toggleVirtualSpace(self) -> None:
"""
Toggle the VirtualSpace status of a constraint
"""
...
def setActive(self, constraintIndex: int, state: bool) -> None:
"""
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.
"""
...
@constmethod
def getActive(self, constraintIndex: int) -> bool:
"""
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.
"""
...
def toggleActive(self, constraintIndex: int) -> None:
"""
Toggle the constraint between active (enforced) and inactive.
toggleActive(constraintIndex:int)
Args:
constraintIndex: The zero-based index of the constraint to toggle.
"""
...
@constmethod
def getLabelPosition(self, constraintIndex: int) -> float:
"""
Get label position of the constraint.
getLabelPosition(constraintIndex:int)
Args:
constraintIndex: The zero-based index of the constraint to query.
Returns:
float with the current value.
"""
...
def setLabelPosition(self, constraintIndex: int, value: float) -> None:
"""
Set label position of the constraint.
setLabelPosition(constraintIndex:int, value:float)
Args:
constraintIndex: The zero-based index of the constraint to query.
value: Value of the label position.
"""
...
@constmethod
def getLabelDistance(self, constraintIndex: int) -> float:
"""
Get label distance of the constraint.
getLabelDistance(constraintIndex:int)
Args:
constraintIndex: The zero-based index of the constraint to query.
Returns:
float with the current value.
"""
...
def setLabelDistance(self, constraintIndex: int, value: float) -> None:
"""
Set label distance of the constraint.
setLabelDistance(constraintIndex:int, value:float)
Args:
constraintIndex: The zero-based index of the constraint to query.
value: Value of the label position.
"""
...
def moveGeometry(
self, GeoIndex: int, PointPos: int, Vector: Vector, relative: bool = False
) -> None:
"""
Move a given point (or curve) to another location.
moveGeometry(GeoIndex,PointPos,Vector,[relative])
It moves the specified point (or curve) to the given location by adding some
temporary weak constraints and solving the sketch.
This method is mostly used to allow the user to drag some portions of the sketch
in real time by e.g. the mouse and it works only for underconstrained portions of
the sketch.
The argument 'relative', if present, states if the new location is given
relatively to the current one.
"""
...
def moveGeometries(
self, Geos: List[Tuple[int, int]], Vector: Vector, relative: bool = False
) -> None:
"""
Move given points and curves to another location.
moveGeometries(Geos,Vector,[relative])
It moves the specified points and curves to the given location by adding some
temporary weak constraints and solving the sketch.
This method is mostly used to allow the user to drag some portions of the sketch
in real time by e.g. the mouse and it works only for underconstrained portions of
the sketch.
The argument 'relative', if present, states if the new location is given
relatively to the current one. For group dragging this is enforced.
Geos is a vector of pairs of geoId and posId.
"""
...
@constmethod
def getPoint(self, GeoIndex: int, PointPos: int) -> Vector:
"""
Retrieve the vector of a point in the sketch.
getPoint(GeoIndex,PointPos)
"""
...
@constmethod
def getGeoVertexIndex(self, index: int) -> Tuple[int, int]:
"""
Retrieve the GeoId and PosId of a point in the sketch.
(geoId, posId) = getGeoVertexIndex(index)
"""
...
@constmethod
def getAxis(self) -> Axis:
"""
Return an axis based on the corresponding construction line
"""
...
def fillet(self) -> None:
"""
Create a fillet between two edges or at a point
"""
...
def trim(self) -> None:
"""
Trim a curve with a given id at a given reference point
"""
...
def extend(self) -> None:
"""
Extend a curve to new start and end positions
"""
...
def split(self) -> None:
"""
Split a curve with a given id at a given reference point
"""
...
def join(self) -> None:
"""
Join two curves at the given end points
"""
...
def addSymmetric(self) -> None:
"""
Add symmetric geometric objects to the sketch with respect to a reference point or line
"""
...
def addCopy(self) -> None:
"""
Add a copy of geometric objects to the sketch displaced by a vector3d
"""
...
def addMove(self) -> None:
"""
Move the geometric objects in the sketch displaced by a vector3d
"""
...
def addRectangularArray(self) -> None:
"""
Add an array of size cols by rows where each element is a copy of the selected geometric objects displaced by a vector3d in the cols direction and by a vector perpendicular to it in the rows direction
"""
...
def removeAxesAlignment(self) -> None:
"""
Modifies constraints so that the shape is not forced to be aligned with axes.
"""
...
def ExposeInternalGeometry(self) -> None:
"""
Deprecated -- use exposeInternalGeometry
"""
...
def DeleteUnusedInternalGeometry(self) -> None:
"""
Deprecated -- use deleteUnusedInternalGeometry
"""
...
def exposeInternalGeometry(self) -> None:
"""
Exposes all internal geometry of an object supporting internal geometry
"""
...
def deleteUnusedInternalGeometry(self) -> None:
"""
Deletes all unused (not further constrained) internal geometry
"""
...
def convertToNURBS(self) -> None:
"""
Approximates the given geometry with a B-spline
"""
...
def increaseBSplineDegree(self) -> None:
"""
Increases the given B-spline Degree by a number of degrees
"""
...
def decreaseBSplineDegree(self) -> None:
"""
Decreases the given B-spline Degree by a number of degrees by approximating this curve
"""
...
def modifyBSplineKnotMultiplicity(self) -> None:
"""
Increases or reduces the given BSpline knot multiplicity
"""
...
def insertBSplineKnot(self) -> None:
"""
Inserts a knot into the BSpline at the given param with given multiplicity. If the knot already exists, this increases the knot multiplicity by the given multiplicity.
"""
...
def calculateAngleViaPoint(self, GeoId1: int, GeoId2: int, px: float, py: float) -> float:
"""
calculateAngleViaPoint(GeoId1, GeoId2, px, py) - calculates angle between
curves identified by GeoId1 and GeoId2 at point (x,y). The point must be
on intersection of the curves, otherwise the result may be useless (except
line-to-line, where (0,0) is OK). Returned value is in radians.
"""
...
def isPointOnCurve(self, GeoIdCurve: int, x: float, y: float) -> bool:
"""
isPointOnCurve(GeoIdCurve, float x, float y) -> bool - tests if the point (x,y)
geometrically lies on a curve (e.g. ellipse). It treats lines as infinite,
arcs as full circles/ellipses/etc.
"""
...
def calculateConstraintError(self, index: int) -> float:
"""
calculateConstraintError(index) - calculates the error function of the
constraint identified by its index and returns the signed error value.
The error value roughly corresponds to by how much the constraint is
violated. If the constraint internally has more than one error function,
the returned value is RMS of all errors (sign is lost in this case).
"""
...
def changeConstraintsLocking(self, bLock: bool) -> None:
"""
changeConstraintsLocking(bLock) - locks or unlocks all tangent and
perpendicular constraints. (Constraint locking prevents it from
flipping to another valid configuration, when e.g. external geometry
is updated from outside.) The sketch solve is not triggered by the
function, but the SketchObject is touched (a recompute will be
necessary). The geometry should not be affected by the function.
The bLock argument specifies, what to do. If true, all constraints
are unlocked and locked again. If false, all tangent and perp.
constraints are unlocked.
"""
...
def getGeometryWithDependentParameters(self) -> List[Tuple[int, int]]:
"""
getGeometryWithDependentParameters - returns a list of geoid posid pairs
with all the geometry element edges and vertices which the solver regards
as being dependent on other parameters.
"""
...
def autoconstraint(self) -> None:
"""
Automatic sketch constraining algorithm.
"""
...
def detectMissingPointOnPointConstraints(self) -> None:
"""
Detects missing Point On Point Constraints. The detect step just identifies possible missing constraints.
The result may be retrieved or applied using the corresponding Get / Make methods.
"""
...
def analyseMissingPointOnPointCoincident(self) -> None:
"""
Analyses the already detected missing Point On Point Constraints to detect endpoint tangency/perpendicular.
The result may be retrieved or applied using the corresponding Get / Make methods.
"""
...
def detectMissingVerticalHorizontalConstraints(self) -> None:
"""
Detects missing Horizontal/Vertical Constraints. The detect step just identifies possible missing constraints.
The result may be retrieved or applied using the corresponding Get / Make methods.
"""
...
def detectMissingEqualityConstraints(self) -> None:
"""
Detects missing Equality Constraints. The detect step just identifies possible missing constraints.
The result may be retrieved or applied using the corresponding Get / Make methods.
"""
...
def makeMissingPointOnPointCoincident(self, arg: bool) -> None:
"""
Applies the detected / set Point On Point coincident constraints. If the argument is True, then solving and redundant removal is done after each individual addition.
"""
...
def makeMissingVerticalHorizontal(self, arg: bool) -> None:
"""
Applies the detected / set Vertical/Horizontal constraints. If the argument is True, then solving and redundant removal is done after each individual addition.
"""
...
def makeMissingEquality(self, arg: bool) -> None:
"""
Applies the detected / set Equality constraints. If the argument is True, then solving and redundant removal is done after each individual addition.
"""
...
@constmethod
@no_args
def evaluateConstraints(self) -> bool:
"""
Check for constraints with invalid indexes. Returns True if invalid constraints are found, False otherwise.
"""
...
@no_args
def validateConstraints(self) -> None:
"""
Removes constraints with invalid indexes.
"""
...
def autoRemoveRedundants(self, arg: bool) -> None:
"""
Removes constraints currently detected as redundant by the solver. If the argument is True, then the geometry is updated after solving.
"""
...
def toPythonCommands(self) -> None:
"""
Prints the commands that should be executed to recreate the Geometry and Constraints of the present sketch (excluding any External Geometry).
"""
...
def setGeometryId():
"""
Sets the GeometryId of the SketchGeometryExtension of the geometry with the provided GeoId
"""
...
def getGeometryId():
"""
Gets the GeometryId of the SketchGeometryExtension of the geometry with the provided GeoId
"""
...

View File

@@ -20,14 +20,14 @@ 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.
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.
</UserDocu>
</Documentation>
</Methode>
@@ -366,7 +366,7 @@ Moves all datum constraints to the end of the constraint list.
moveDatumsToEnd()
Warning: This method reorders the constraint indices. Previously hold
Warning: This method reorders the constraint indices. Previously held
numeric references to constraints may reference different constraints
after this operation.
</UserDocu>
@@ -402,7 +402,7 @@ toggleDriving(constraintIndex:int)
</Methode>
<Methode Name="setVirtualSpace">
<Documentation>
<UserDocu>set the VirtualSpace status of a constraint</UserDocu>
<UserDocu>Set the VirtualSpace status of a constraint</UserDocu>
</Documentation>
</Methode>
<Methode Name="getVirtualSpace">
@@ -412,7 +412,7 @@ toggleDriving(constraintIndex:int)
</Methode>
<Methode Name="toggleVirtualSpace">
<Documentation>
<UserDocu>toggle the VirtualSpace status of a constraint</UserDocu>
<UserDocu>Toggle the VirtualSpace status of a constraint</UserDocu>
</Documentation>
</Methode>
<Methode Name="setActive">
@@ -516,103 +516,111 @@ setLabelDistance(constraintIndex:int, value:float)
<Methode Name="moveGeometry">
<Documentation>
<UserDocu>
moveGeometry(GeoIndex,PointPos,Vector,[relative]) - move a given point (or curve)
to another location.
It moves the specified point (or curve) to the given location by adding some
temporary weak constraints and solve the sketch.
This method is mostly used to allow the user to drag some portions of the sketch
in real time by e.g. the mouse and it works only for underconstrained portions of
the sketch.
The argument 'relative', if present, states if the new location is given
relatively to the current one.
Move a given point (or curve) to another location.
moveGeometry(GeoIndex,PointPos,Vector,[relative])
It moves the specified point (or curve) to the given location by adding some
temporary weak constraints and solving the sketch.
This method is mostly used to allow the user to drag some portions of the sketch
in real time by e.g. the mouse and it works only for underconstrained portions of
the sketch.
The argument 'relative', if present, states if the new location is given
relatively to the current one.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="moveGeometries">
<Documentation>
<UserDocu>
moveGeometries(Geos,Vector,[relative]) - move given points and curves
to another location.
It moves the specified points and curves to the given location by adding some
temporary weak constraints and solve the sketch.
This method is mostly used to allow the user to drag some portions of the sketch
in real time by e.g. the mouse and it works only for underconstrained portions of
the sketch.
The argument 'relative', if present, states if the new location is given
relatively to the current one. For group dragging this is enforced.
Geos is a vector of pairs of geoId and posId.
Move given points and curves to another location.
moveGeometries(Geos,Vector,[relative])
It moves the specified points and curves to the given location by adding some
temporary weak constraints and solving the sketch.
This method is mostly used to allow the user to drag some portions of the sketch
in real time by e.g. the mouse and it works only for underconstrained portions of
the sketch.
The argument 'relative', if present, states if the new location is given
relatively to the current one. For group dragging this is enforced.
Geos is a vector of pairs of geoId and posId.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="getPoint" Const="true">
<Documentation>
<UserDocu>
getPoint(GeoIndex,PointPos) - retrieve the vector of a point in the sketch
Retrieve the vector of a point in the sketch.
getPoint(GeoIndex,PointPos)
</UserDocu>
</Documentation>
</Methode>
<Methode Name="getGeoVertexIndex" Const="true">
<Documentation>
<UserDocu>
(geoId, posId) = getGeoVertexIndex(index) - retrieve the GeoId and PosId of a point in the sketch
Retrieve the GeoId and PosId of a point in the sketch.
(geoId, posId) = getGeoVertexIndex(index)
</UserDocu>
</Documentation>
</Methode>
<Methode Name="getAxis" Const="true">
<Documentation>
<UserDocu>
return an axis based on the corresponding construction line
Return an axis based on the corresponding construction line
</UserDocu>
</Documentation>
</Methode>
<Methode Name="fillet">
<Documentation>
<UserDocu>create fillet between two edges or at a point</UserDocu>
<UserDocu>Create a fillet between two edges or at a point</UserDocu>
</Documentation>
</Methode>
<Methode Name="trim">
<Documentation>
<UserDocu>trim a curve with a given id at a given reference point</UserDocu>
<UserDocu>Trim a curve with a given id at a given reference point</UserDocu>
</Documentation>
</Methode>
<Methode Name="extend">
<Documentation>
<UserDocu>extend a curve to new start and end positions</UserDocu>
<UserDocu>Extend a curve to new start and end positions</UserDocu>
</Documentation>
</Methode>
<Methode Name="split">
<Documentation>
<UserDocu>split a curve with a given id at a given reference point</UserDocu>
<UserDocu>Split a curve with a given id at a given reference point</UserDocu>
</Documentation>
</Methode>
<Methode Name="join">
<Documentation>
<UserDocu>join two curves at the given end points</UserDocu>
<UserDocu>Join two curves at the given end points</UserDocu>
</Documentation>
</Methode>
<Methode Name="addSymmetric">
<Documentation>
<UserDocu>add a symmetric geometric objects to the sketch with respect to a reference point or line</UserDocu>
<UserDocu>Add symmetric geometric objects to the sketch with respect to a reference point or line</UserDocu>
</Documentation>
</Methode>
<Methode Name="addCopy">
<Documentation>
<UserDocu>add a copy of geometric objects to the sketch displaced by a vector3d</UserDocu>
<UserDocu>Add a copy of geometric objects to the sketch displaced by a vector3d</UserDocu>
</Documentation>
</Methode>
<Methode Name="addMove">
<Documentation>
<UserDocu>Moves the geometric objects in the sketch displaced by a vector3d</UserDocu>
<UserDocu>Move the geometric objects in the sketch displaced by a vector3d</UserDocu>
</Documentation>
</Methode>
<Methode Name="addRectangularArray">
<Documentation>
<UserDocu>add an array of size cols by rows where each element is a copy of the selected geometric objects displaced by a vector3d in the cols direction and by a vector perpendicular to it in the rows direction</UserDocu>
<UserDocu>Add an array of size cols by rows where each element is a copy of the selected geometric objects displaced by a vector3d in the cols direction and by a vector perpendicular to it in the rows direction</UserDocu>
</Documentation>
</Methode>
<Methode Name="removeAxesAlignment">
<Documentation>
<UserDocu>modifies constraints so that the shape is not forced to be aligned with axes.</UserDocu>
<UserDocu>Modifies constraints so that the shape is not forced to be aligned with axes.</UserDocu>
</Documentation>
</Methode>
<Methode Name="ExposeInternalGeometry">
@@ -663,150 +671,150 @@ setLabelDistance(constraintIndex:int, value:float)
<Methode Name="calculateAngleViaPoint">
<Documentation>
<UserDocu>
calculateAngleViaPoint(GeoId1, GeoId2, px, py) - calculates angle between
curves identified by GeoId1 and GeoId2 at point (x,y). The point must be
on intersection of the curves, otherwise the result may be useless (except
line-to-line, where (0,0) is OK). Returned value is in radians.
calculateAngleViaPoint(GeoId1, GeoId2, px, py) - calculates angle between
curves identified by GeoId1 and GeoId2 at point (x,y). The point must be
on intersection of the curves, otherwise the result may be useless (except
line-to-line, where (0,0) is OK). Returned value is in radians.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="isPointOnCurve">
<Documentation>
<UserDocu>
isPointOnObject(GeoIdCurve, float x, float y) - tests if the point (x,y)
geometrically lies on a curve (e.g. ellipse). It treats lines as infinite,
arcs as full circles/ellipses/etc. Returns boolean value.
isPointOnCurve(GeoIdCurve, float x, float y) -> bool - tests if the point (x,y)
geometrically lies on a curve (e.g. ellipse). It treats lines as infinite,
arcs as full circles/ellipses/etc.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="calculateConstraintError">
<Documentation>
<UserDocu>
calculateConstraintError(index) - calculates the error function of the
constraint identified by its index and returns the signed error value.
The error value roughly corresponds to by how much the constraint is
violated. If the constraint internally has more than one error function,
the returned value is RMS of all errors (sign is lost in this case).
calculateConstraintError(index) - calculates the error function of the
constraint identified by its index and returns the signed error value.
The error value roughly corresponds to by how much the constraint is
violated. If the constraint internally has more than one error function,
the returned value is RMS of all errors (sign is lost in this case).
</UserDocu>
</Documentation>
</Methode>
<Methode Name="changeConstraintsLocking">
<Documentation>
<UserDocu>
changeConstraintsLocking(bLock) - locks or unlocks all tangent and
perpendicular constraints. (Constraint locking prevents it from
flipping to another valid configuration, when e.g. external geometry
is updated from outside.) The sketch solve is not triggered by the
function, but the SketchObject is touched (a recompute will be
necessary). The geometry should not be affected by the function.
changeConstraintsLocking(bLock) - locks or unlocks all tangent and
perpendicular constraints. (Constraint locking prevents it from
flipping to another valid configuration, when e.g. external geometry
is updated from outside.) The sketch solve is not triggered by the
function, but the SketchObject is touched (a recompute will be
necessary). The geometry should not be affected by the function.
The bLock argument specifies, what to do. If true, all constraints
are unlocked and locked again. If false, all tangent and perp.
constraints are unlocked.
The bLock argument specifies, what to do. If true, all constraints
are unlocked and locked again. If false, all tangent and perp.
constraints are unlocked.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="getGeometryWithDependentParameters">
<Documentation>
<UserDocu>
getGeometryWithDependentParameters - returns a list of geoid posid pairs
with all the geometry element edges and vertices which the solver regards
as being dependent on other parameters.
getGeometryWithDependentParameters - returns a list of geoid posid pairs
with all the geometry element edges and vertices which the solver regards
as being dependent on other parameters.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="autoconstraint">
<Documentation>
<UserDocu>
Automatic sketch constraining algorithm.
Automatic sketch constraining algorithm.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="detectMissingPointOnPointConstraints">
<Documentation>
<UserDocu>
Detects Missing Point On Point Constraints. The Detect step just identifies possible missing constraints.
The result may be retrieved or applied using the corresponding Get / Make methods.
Detects missing Point On Point Constraints. The detect step just identifies possible missing constraints.
The result may be retrieved or applied using the corresponding Get / Make methods.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="analyseMissingPointOnPointCoincident">
<Documentation>
<UserDocu>
Analyses the already detected Missing Point On Point Constraints to detect endpoint tagency/perpendicular.
The result may be retrieved or applied using the corresponding Get / Make methods.
Analyses the already detected missing Point On Point Constraints to detect endpoint tangency/perpendicular.
The result may be retrieved or applied using the corresponding Get / Make methods.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="detectMissingVerticalHorizontalConstraints">
<Documentation>
<UserDocu>
Detects Missing Horizontal/Vertical Constraints. The Detect step just identifies possible missing constraints.
The result may be retrieved or applied using the corresponding Get / Make methods.
Detects missing Horizontal/Vertical Constraints. The detect step just identifies possible missing constraints.
The result may be retrieved or applied using the corresponding Get / Make methods.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="detectMissingEqualityConstraints">
<Documentation>
<UserDocu>
Detects Missing Equality Constraints. The Detect step just identifies possible missing constraints.
The result may be retrieved or applied using the corresponding Get / Make methods.
Detects missing Equality Constraints. The detect step just identifies possible missing constraints.
The result may be retrieved or applied using the corresponding Get / Make methods.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="makeMissingPointOnPointCoincident">
<Documentation>
<UserDocu>
Applies the detected / set Point On Point coincident constraints. If the argument is True, then solving and redundant removal is done after each individual addition.
Applies the detected / set Point On Point coincident constraints. If the argument is True, then solving and redundant removal is done after each individual addition.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="makeMissingVerticalHorizontal">
<Documentation>
<UserDocu>
Applies the detected / set Vertical/Horizontal constraints. If the argument is True, then solving and redundant removal is done after each individual addition.
Applies the detected / set Vertical/Horizontal constraints. If the argument is True, then solving and redundant removal is done after each individual addition.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="makeMissingEquality">
<Documentation>
<UserDocu>
Applies the detected / set Equality constraints. If the argument is True, then solving and redundant removal is done after each individual addition.
Applies the detected / set Equality constraints. If the argument is True, then solving and redundant removal is done after each individual addition.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="evaluateConstraints" Const="true" NoArgs="true">
<Documentation>
<UserDocu>
Check for constraints with invalid indexes. Returns True if invalid constraints are found, False otherwise.
Check for constraints with invalid indexes. Returns True if invalid constraints are found, False otherwise.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="validateConstraints" NoArgs="true">
<Documentation>
<UserDocu>
Removes constraints with invalid indexes.
Removes constraints with invalid indexes.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="autoRemoveRedundants">
<Documentation>
<UserDocu>
Removes constraints currently detected as redundant by the solver. If the argument is True, then the geometry is updated after solving.
Removes constraints currently detected as redundant by the solver. If the argument is True, then the geometry is updated after solving.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="toPythonCommands">
<Documentation>
<UserDocu>
Prints the commands that should be executed to recreate the Geometry and Constraints of the present sketch (excluding any External Geometry).
Prints the commands that should be executed to recreate the Geometry and Constraints of the present sketch (excluding any External Geometry).
</UserDocu>
</Documentation>
</Methode>
<Attribute Name="MissingPointOnPointConstraints" ReadOnly="false">
<Documentation>
<UserDocu>
returns a list of (First FirstPos Second SecondPos Type) tuples with all the detected endpoint constraints.
Returns a list of (First FirstPos Second SecondPos Type) tuples with all the detected endpoint constraints.
</UserDocu>
</Documentation>
<Parameter Name="MissingPointOnPointConstraints" Type="List"/>
@@ -814,7 +822,7 @@ setLabelDistance(constraintIndex:int, value:float)
<Attribute Name="MissingVerticalHorizontalConstraints" ReadOnly="false">
<Documentation>
<UserDocu>
returns a list of (First FirstPos Second SecondPos Type) tuples with all the detected vertical/horizontal constraints.
Returns a list of (First FirstPos Second SecondPos Type) tuples with all the detected vertical/horizontal constraints.
</UserDocu>
</Documentation>
<Parameter Name="MissingVerticalHorizontalConstraints" Type="List"/>
@@ -822,7 +830,7 @@ setLabelDistance(constraintIndex:int, value:float)
<Attribute Name="MissingLineEqualityConstraints" ReadOnly="false">
<Documentation>
<UserDocu>
returns a list of (First FirstPos Second SecondPos) tuples with all the detected line segment equality constraints.
Returns a list of (First FirstPos Second SecondPos) tuples with all the detected line segment equality constraints.
</UserDocu>
</Documentation>
<Parameter Name="MissingLineEqualityConstraints" Type="List"/>
@@ -830,7 +838,7 @@ setLabelDistance(constraintIndex:int, value:float)
<Attribute Name="MissingRadiusConstraints" ReadOnly="false">
<Documentation>
<UserDocu>
returns a list of (First FirstPos Second SecondPos) tuples with all the detected radius constraints.
Returns a list of (First FirstPos Second SecondPos) tuples with all the detected radius constraints.
</UserDocu>
</Documentation>
<Parameter Name="MissingRadiusConstraints" Type="List"/>
@@ -838,7 +846,7 @@ setLabelDistance(constraintIndex:int, value:float)
<Attribute Name="OpenVertices" ReadOnly="true">
<Documentation>
<UserDocu>
returns a list of vertices positions.
Returns a list of vertices positions.
</UserDocu>
</Documentation>
<Parameter Name="OpenVertices" Type="List"/>
@@ -913,12 +921,12 @@ setLabelDistance(constraintIndex:int, value:float)
</Attribute>
<Methode Name="setGeometryId">
<Documentation>
<UserDocu>sets the GeometryId of the SketchGeometryExtension of the geometry with the provided GeoId</UserDocu>
<UserDocu>Sets the GeometryId of the SketchGeometryExtension of the geometry with the provided GeoId</UserDocu>
</Documentation>
</Methode>
<Methode Name="getGeometryId">
<Documentation>
<UserDocu>gets the GeometryId of the SketchGeometryExtension of the geometry with the provided GeoId</UserDocu>
<UserDocu>Gets the GeometryId of the SketchGeometryExtension of the geometry with the provided GeoId</UserDocu>
</Documentation>
</Methode>
</PythonExport>

View File

@@ -0,0 +1,16 @@
from Base.Metadata import export
from Part.Part2DObject import Part2DObject
@export(
Include="Mod/Sketcher/App/SketchObjectSF.h",
FatherInclude="Mod/Part/App/Part2DObjectPy.h",
)
class SketchObjectSF(Part2DObject):
"""
With this objects you can handle sketches
Author: Juergen Riegel (FreeCAD@juergen-riegel.net)
Licence: LGPL
"""
...

View File

@@ -17,36 +17,36 @@
</Documentation>
<Methode Name="solve">
<Documentation>
<UserDocu>solve the actual set of geometry and constraints</UserDocu>
<UserDocu>Solve the actual set of geometry and constraints</UserDocu>
</Documentation>
</Methode>
<Methode Name="addGeometry">
<Documentation>
<UserDocu>add a geometric object to the sketch</UserDocu>
<UserDocu>Add a geometric object to the sketch</UserDocu>
</Documentation>
</Methode>
<Methode Name="addConstraint">
<Documentation>
<UserDocu>add an constraint object to the sketch</UserDocu>
<UserDocu>Add an constraint object to the sketch</UserDocu>
</Documentation>
</Methode>
<Methode Name="clear">
<Documentation>
<UserDocu>clear the sketch</UserDocu>
<UserDocu>Clear the sketch</UserDocu>
</Documentation>
</Methode>
<Methode Name="moveGeometry">
<Documentation>
<UserDocu>
moveGeometry(GeoIndex,PointPos,Vector,[relative]) - move a given point (or curve)
to another location.
It moves the specified point (or curve) to the given location by adding some
temporary weak constraints and solve the sketch.
This method is mostly used to allow the user to drag some portions of the sketch
in real time by e.g. the mouse and it works only for underconstrained portions of
the sketch.
The argument 'relative', if present, states if the new location is given
relatively to the current one.
moveGeometry(GeoIndex,PointPos,Vector,[relative]) - move a given point (or curve)
to another location.
It moves the specified point (or curve) to the given location by adding some
temporary weak constraints and solve the sketch.
This method is mostly used to allow the user to drag some portions of the sketch
in real time by e.g. the mouse and it works only for underconstrained portions of
the sketch.
The argument 'relative', if present, states if the new location is given
relatively to the current one.
</UserDocu>
</Documentation>
</Methode>

View File

@@ -18,6 +18,7 @@ qt_create_resource_file(${Sketcher_TR_QRC} ${QM_SRCS})
qt_add_resources(SketcherGui_SRCS Resources/Sketcher.qrc ${Sketcher_TR_QRC})
generate_from_xml(ViewProviderSketchGeometryExtensionPy)
generate_from_py_(ViewProviderSketchGeometryExtension)
set(SketcherGui_UIC_SRCS
TaskSketcherConstraints.ui

View File

@@ -0,0 +1,20 @@
from Base.Metadata import export
from Part.App.GeometryExtension import GeometryExtension
@export(
PythonName="SketcherGui.ViewProviderSketchGeometryExtension",
Include="Mod/Sketcher/Gui/ViewProviderSketchGeometryExtension.h",
Namespace="SketcherGui",
FatherInclude="Mod/Part/App/GeometryExtensionPy.h",
Constructor=True,
)
class ViewProviderSketchGeometryExtension(GeometryExtension):
"""
Describes a ViewProviderSketchGeometryExtension
Author: Abdullah Tahiri (abdullah.tahiri.yo@gmail.com)
Licence: LGPL
"""
VisualLayerId: int = ...
"""Sets/returns this geometry's Visual Layer Id."""