-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #65 from tpaviot/review/fixes
Review/fixes
- Loading branch information
Showing
17 changed files
with
166 additions
and
79 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
##Copyright 2023 Thomas Paviot ([email protected]) | ||
## | ||
##This file is part of pythonOCC. | ||
## | ||
##pythonOCC is free software: you can redistribute it and/or modify | ||
##it under the terms of the GNU Lesser General Public License as published by | ||
##the Free Software Foundation, either version 3 of the License, or | ||
##(at your option) any later version. | ||
## | ||
##pythonOCC is distributed in the hope that it will be useful, | ||
##but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
##MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
##GNU Lesser General Public License for more details. | ||
## | ||
##You should have received a copy of the GNU Lesser General Public License | ||
##along with pythonOCC. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
from OCC.Core.TDocStd import TDocStd_Document | ||
from OCC.Core.Message import Message_ProgressRange | ||
from OCC.Core.RWGltf import RWGltf_CafReader | ||
from OCC.Core.IFSelect import IFSelect_RetDone | ||
|
||
from OCC.Display.SimpleGui import init_display | ||
|
||
filename = "../assets/models/2CylinderEngine.glb" | ||
|
||
# create an handle to a document | ||
doc = TDocStd_Document("pythonocc-doc") | ||
|
||
gltf_reader = RWGltf_CafReader() | ||
|
||
# gltf_reader.SetSystemLengthUnit(aScaleFactorM) | ||
# gltf_reader.SetSystemCoordinateSystem(RWMesh_CoordinateSystem_Zup) | ||
gltf_reader.SetDocument(doc) | ||
# gltf_reader.SetParallel(True) | ||
# gltf_reader.SetDoublePrecision(True) | ||
# gltf_reader.SetToSkipLateDataLoading(True) | ||
# gltf_reader.SetToKeepLateData(True) | ||
# gltf_reader.SetToPrintDebugMessages(True) | ||
# gltf_reader.SetLoadAllScenes(True) | ||
status = gltf_reader.Perform(filename, Message_ProgressRange()) | ||
|
||
assert status == IFSelect_RetDone | ||
|
||
shp = gltf_reader.SingleShape() | ||
|
||
# | ||
# Display | ||
# | ||
display, start_display, add_menu, add_function_to_menu = init_display() | ||
display.DisplayShape(shp, update=True) | ||
start_display() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
##Copyright 2023 Thomas Paviot ([email protected]) | ||
## | ||
##This file is part of pythonOCC. | ||
## | ||
##pythonOCC is free software: you can redistribute it and/or modify | ||
##it under the terms of the GNU Lesser General Public License as published by | ||
##the Free Software Foundation, either version 3 of the License, or | ||
##(at your option) any later version. | ||
## | ||
##pythonOCC is distributed in the hope that it will be useful, | ||
##but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
##MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
##GNU Lesser General Public License for more details. | ||
## | ||
##You should have received a copy of the GNU Lesser General Public License | ||
##along with pythonOCC. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
from OCC.Core.TDocStd import TDocStd_Document | ||
from OCC.Core.XCAFDoc import ( | ||
XCAFDoc_DocumentTool_MaterialTool, | ||
) | ||
from OCC.Core.STEPCAFControl import STEPCAFControl_Reader | ||
from OCC.Core.IFSelect import IFSelect_RetDone | ||
from OCC.Core.TDF import TDF_LabelSequence | ||
|
||
filename = "../assets/models/eight_cyl.stp" | ||
|
||
# create an handle to a document | ||
doc = TDocStd_Document("pythonocc-doc") | ||
|
||
# Get root assembly | ||
mat_tool = XCAFDoc_DocumentTool_MaterialTool(doc.Main()) | ||
|
||
step_reader = STEPCAFControl_Reader() | ||
|
||
status = step_reader.ReadFile(filename) | ||
if status == IFSelect_RetDone: | ||
step_reader.Transfer(doc) | ||
|
||
material_labels = TDF_LabelSequence() | ||
|
||
mat_tool.GetMaterialLabels(material_labels) | ||
|
||
# materials | ||
for i in range(1, material_labels.Length() + 1): | ||
( | ||
ok, | ||
material_name, | ||
material_description, | ||
material_density, | ||
material_densname, | ||
material_densvaltype, | ||
) = mat_tool.GetMaterial(material_labels.Value(i)) | ||
|
||
print(f"Material name: {material_name}") | ||
print(f"Material description: {material_description}") | ||
print(f"Material density: {material_density}") | ||
print(f"Material densname: {material_densname}") | ||
print(f"Material_densvaltype: {material_densvaltype}\n") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.