Well FreeCAD objects are in general parametric, for example Cube has Length, Width. Cylinder has radius, height etc. So to me it does not make much sense just being able to Scale the Shape without changing the related parameters. Now with this and I suspect most Import STEP files the 'Objects' are Brep Shapes without parameters and I am not sure why they should be immutable as far as scaling is concerned.
Component1 has an Object Type of 'Part::Feature', printing out its details with print(dir(object)) gives
Code: Select all
['Content', 'Document', 'ExpressionEngine', 'FullName', 'ID', 'InList', 'InListRecursive', 'Label', 'Label2', 'MemSize', 'Module', 'MustExecute', 'Name', 'NoTouch', 'OldLabel', 'OutList', 'OutListRecursive', 'Parents', 'Placement', 'PropertiesList', 'Removing', 'Shape', 'State', 'TypeId', 'ViewObject', 'Visibility', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'addExtension', 'addObject', 'addObjects', 'addProperty', 'adjustRelativeLinks', 'dumpContent', 'dumpPropertyContent', 'enforceRecompute', 'evalExpression', 'getAllDerivedFrom', 'getDocumentationOfProperty', 'getEditorMode', 'getGlobalPlacement', 'getGroupOfProperty', 'getLinkedObject', 'getObject', 'getParentGeoFeatureGroup', 'getParentGroup', 'getPaths', 'getPathsByOutList', 'getPropertyByName', 'getPropertyNameOfGeometry', 'getPropertyOfGeometry', 'getPropertyStatus', 'getPropertyTouchList', 'getStatusString', 'getSubObject', 'getSubObjectList', 'getSubObjects', 'getTypeIdOfProperty', 'getTypeOfProperty', 'hasChildElement', 'hasExtension', 'hasObject', 'isDerivedFrom', 'isElementVisible', 'isValid', 'newObject', 'purgeTouched', 'recompute', 'removeObject', 'removeObjects', 'removeObjectsFromDocument', 'removeProperty', 'resolve', 'resolveSubElement', 'restoreContent', 'restorePropertyContent', 'setEditorMode', 'setElementVisible', 'setExpression', 'setObjects', 'setPropertyStatus', 'supportedProperties', 'touch']
and print(dir(object.Shape))
Code: Select all
['Area', 'BoundBox', 'CenterOfMass', 'CompSolids', 'Compounds', 'Content', 'Edges', 'Faces', 'Length', 'Mass', 'Matrix', 'MatrixOfInertia', 'MemSize', 'Module', 'Orientation', 'OuterShell', 'Placement', 'PrincipalProperties', 'ShapeType', 'Shells', 'Solids', 'StaticMoments', 'SubShapes', 'Tag', 'TypeId', 'Vertexes', 'Volume', 'Wires', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setstate__', '__sizeof__', '__str__', '__subclasshook__', 'ancestorsOfType', 'check', 'childShapes', 'cleaned', 'common', 'complement', 'copy', 'countElement', 'cut', 'defeaturing', 'distToShape', 'dumpContent', 'dumpToString', 'exportBinary', 'exportBrep', 'exportBrepToString', 'exportIges', 'exportStep', 'exportStl', 'extrude', 'findPlane', 'fix', 'fixTolerance', 'fuse', 'generalFuse', 'getAllDerivedFrom', 'getElement', 'getFacesFromSubelement', 'getMomentOfInertia', 'getRadiusOfGyration', 'getTolerance', 'globalTolerance', 'hashCode', 'importBinary', 'importBrep', 'importBrepFromString', 'inTolerance', 'isClosed', 'isCoplanar', 'isDerivedFrom', 'isEqual', 'isInfinite', 'isInside', 'isNull', 'isPartner', 'isSame', 'isValid', 'limitTolerance', 'makeChamfer', 'makeFillet', 'makeOffset2D', 'makeOffsetShape', 'makeParallelProjection', 'makePerspectiveProjection', 'makeShapeFromMesh', 'makeThickness', 'makeWires', 'mirror', 'multiFuse', 'nullify', 'offsetFaces', 'oldFuse', 'optimalBoundingBox', 'overTolerance', 'project', 'proximity', 'read', 'reflectLines', 'removeInternalWires', 'removeShape', 'removeSplitter', 'replaceShape', 'restoreContent', 'reverse', 'reversed', 'revolve', 'rotate', 'rotated', 'scale', 'scaled', 'section', 'sewShape', 'slice', 'slices', 'tessellate', 'toNurbs', 'transformGeometry', 'transformShape', 'transformed', 'translate', 'translated', 'writeInventor']
But calling the Shapes, scale function gives
Code: Select all
21:30:35 Running the Python command 'toScaleCommand' failed:
Traceback (most recent call last):
File "/Users/keithsloan/Library/Preferences/FreeCAD/Mod/toSketch/freecad/toSketch/toSCommands.py", line 151, in Activated
sel.Shape.scale(2.0)
This object is immutable, you can not set any attribute or call a non const method
I can understand not being able to scale a Cube, Cylinder etc but not sure why a Brep Shape from a STEP import needs to be set to immutable, or why. a cloned shape is okay to scale.