0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

python関連

Posted at

テストページ。
import streamlit as st
import numpy as np
import pythreejs as p3
from pythreejs import *

def main():
# SolidWorksファイルのアップロード
file = st.file_uploader("SolidWorksファイルをアップロードしてください", type=["sldprt", "sldasm"])
if file is not None:
file_content = file.read()
st.write("アップロードが完了しました")

    # 3Dオブジェクトの表示
    geometry = create_geometry(file_content)
    mesh = create_mesh(geometry)
    scene = create_scene(mesh)
    controller = create_controller(scene)
    st.write(controller)

def create_geometry(file_content):
# SolidWorksファイルからジオメトリを作成する処理を実装する
# この例では、pythreejsのジオメトリを作成する関数を使用しています
geometry = create_your_geometry_from_solidworks(file_content)
return geometry

def create_mesh(geometry):
# ジオメトリからメッシュを作成する処理を実装する
material = MeshLambertMaterial(color='red')
mesh = Mesh(geometry=geometry, material=material)
return mesh

def create_scene(mesh):
# メッシュをシーンに追加する処理を実装する
scene = Scene(children=[mesh, AmbientLight(color='white')])
return scene

def create_controller(scene):
# シーンを表示するコントローラを作成する処理を実装する
controller = p3.Renderer(camera="perspective", scene=scene, controls=[OrbitControls(controlling=scene.camera)])
controller.width = 500
controller.height = 500
return controller

if name == "main":
main()

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?