Stability process predicate evaluation module
This commit is contained in:
parent
78e31ea49c
commit
03bc34539c
19 changed files with 1365 additions and 123 deletions
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"doc": "/home/idontsudo/t/framework/asp-review-app/server/public/cubes/cubes.FCStd",
|
||||
"out": "/home/idontsudo/t/framework/cad_generation",
|
||||
"doc": "/home/idontsudo/framework/asp/out/disk_and_axis_n.FCStd",
|
||||
"out": "/home/idontsudo/framework/asp/out",
|
||||
"resultURL": "http://localhost:3002/assembly/save/out",
|
||||
"projectId": "cubes"
|
||||
}
|
|
@ -36,9 +36,9 @@ class RobossemblerFreeCadExportScenario:
|
|||
self.geometry(directory)
|
||||
ExportAssemblyThemAllUseCase().call(directoryExport)
|
||||
|
||||
shutil.make_archive(directory, 'zip', directory)
|
||||
# shutil.make_archive(directory, 'zip', directory)
|
||||
|
||||
shutil.rmtree(directory)
|
||||
# shutil.rmtree(directory)
|
||||
return True
|
||||
|
||||
def geometry(self, outPutsPath: str):
|
||||
|
|
|
@ -1,38 +1,41 @@
|
|||
import FreeCAD as App
|
||||
from model.sdf_geometry_model import SdfGeometryModel
|
||||
|
||||
|
||||
from helper.is_solid import is_object_solid
|
||||
|
||||
|
||||
class SdfGeometryUseCase:
|
||||
ShapePropertyCheck = ['Mass','MatrixOfInertia','Placement', ]
|
||||
ShapePropertyCheck = ['Mass', 'MatrixOfInertia', 'Placement', ]
|
||||
PartPropertyCheck = ['Shape']
|
||||
def call(self, stlPaths:dict) -> list[SdfGeometryModel]:
|
||||
|
||||
def call(self, stlPaths: dict) -> list[SdfGeometryModel]:
|
||||
materialSolid = {}
|
||||
for el in App.ActiveDocument.Objects:
|
||||
if str(el) == '<App::MaterialObjectPython object>':
|
||||
if str(el) == '<App::MaterialObjectPython object>':
|
||||
friction = el.Material.get('SlidingFriction')
|
||||
for i in el.References:
|
||||
materialSolid[i[0].Label] = friction
|
||||
geometry = []
|
||||
try:
|
||||
for el in App.ActiveDocument.Objects:
|
||||
|
||||
if is_object_solid(el):
|
||||
mass = el.Shape.Mass
|
||||
inertia = el.Shape.MatrixOfInertia
|
||||
pos = el.Shape.Placement
|
||||
inertia = el.Shape.MatrixOfInertia
|
||||
name = el.Label
|
||||
ixx = str(inertia.A11 / 1000000)
|
||||
ixy = str(inertia.A12 / 1000000)
|
||||
ixz = str(inertia.A13 / 1000000)
|
||||
iyy = str(inertia.A22 / 1000000)
|
||||
iyz = str(inertia.A23 / 1000000)
|
||||
izz = str(inertia.A33 / 1000000)
|
||||
massSDF = str(mass / 1000000)
|
||||
posX = str(pos.Base[0] / 1000000)
|
||||
posY = str(pos.Base[1] / 1000000)
|
||||
posZ = str(pos.Base[2] / 1000000)
|
||||
delimiter = 1000000
|
||||
ixx = str(inertia.A11 / delimiter)
|
||||
ixy = str(inertia.A12 / delimiter)
|
||||
ixz = str(inertia.A13 / delimiter)
|
||||
iyy = str(inertia.A22 / delimiter)
|
||||
iyz = str(inertia.A23 / delimiter)
|
||||
izz = str(inertia.A33 / delimiter)
|
||||
massSDF = str(mass / delimiter)
|
||||
posX = str(pos.Base[0] / delimiter)
|
||||
posY = str(pos.Base[1] / delimiter)
|
||||
posZ = str(pos.Base[2] / delimiter)
|
||||
eulerX = str(pos.Rotation.toEuler()[0])
|
||||
eulerY = str(pos.Rotation.toEuler()[1])
|
||||
eulerZ = str(pos.Rotation.toEuler()[2])
|
||||
|
@ -42,10 +45,10 @@ class SdfGeometryUseCase:
|
|||
geometry.append(
|
||||
SdfGeometryModel(
|
||||
stl=stlPaths.get(el.Label),
|
||||
name=name,
|
||||
name=name,
|
||||
ixx=ixx,
|
||||
ixz=ixz,
|
||||
ixy=ixy,
|
||||
ixz=ixz,
|
||||
ixy=ixy,
|
||||
iyy=iyy,
|
||||
iyz=iyz,
|
||||
izz=izz,
|
||||
|
@ -53,8 +56,8 @@ class SdfGeometryUseCase:
|
|||
posX=posX,
|
||||
posY=posY,
|
||||
posZ=posZ,
|
||||
eulerX=eulerX,
|
||||
eulerY=eulerY,
|
||||
eulerX=eulerX,
|
||||
eulerY=eulerY,
|
||||
eulerZ=eulerZ,
|
||||
friction=materialSolid.get(el.Label) or '',
|
||||
centerMassX=centerMassX,
|
||||
|
@ -64,10 +67,4 @@ class SdfGeometryUseCase:
|
|||
)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
return geometry
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue