几何优化分析优化和解决图标不显示
This commit is contained in:
parent
b177cd1396
commit
3f42c0c675
@ -5,8 +5,7 @@
|
||||
<link rel="icon" href="/favicon.ico">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>工业模型软件管理统一平台</title>
|
||||
<!-- Font Awesome 图标库 -->
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
|
||||
<!-- Font Awesome 图标库 (已本地化) -->
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
||||
10
package-lock.json
generated
10
package-lock.json
generated
@ -8,6 +8,7 @@
|
||||
"name": "miany-vue",
|
||||
"version": "0.0.0",
|
||||
"dependencies": {
|
||||
"@fortawesome/fontawesome-free": "^7.1.0",
|
||||
"element-plus": "^2.11.2",
|
||||
"online-3d-viewer": "^0.16.0",
|
||||
"pinia": "^3.0.3",
|
||||
@ -1154,6 +1155,15 @@
|
||||
"integrity": "sha512-aGTxbpbg8/b5JfU1HXSrbH3wXZuLPJcNEcZQFMxLs3oSzgtVu6nFPkbbGGUvBcUjKV2YyB9Wxxabo+HEH9tcRQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@fortawesome/fontawesome-free": {
|
||||
"version": "7.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-7.1.0.tgz",
|
||||
"integrity": "sha512-+WxNld5ZCJHvPQCr/GnzCTVREyStrAJjisUPtUxG5ngDA8TMlPnKp6dddlTpai4+1GNmltAeuk1hJEkBohwZYA==",
|
||||
"license": "(CC-BY-4.0 AND OFL-1.1 AND MIT)",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/@humanfs/core": {
|
||||
"version": "0.19.1",
|
||||
"resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz",
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
"tauri:build": "tauri build"
|
||||
},
|
||||
"dependencies": {
|
||||
"@fortawesome/fontawesome-free": "^7.1.0",
|
||||
"element-plus": "^2.11.2",
|
||||
"online-3d-viewer": "^0.16.0",
|
||||
"pinia": "^3.0.3",
|
||||
|
||||
@ -207,9 +207,10 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { getGeometryOptimizationDefaults } from '@/config/cad.js'
|
||||
import { creoApi } from '@/services/creoApi.js'
|
||||
import { useCADStore } from '@/stores/cad'
|
||||
|
||||
// Emits
|
||||
const emit = defineEmits(['close', 'start-optimization'])
|
||||
@ -230,20 +231,22 @@ const sections = ref({
|
||||
advanced: { expanded: false }
|
||||
})
|
||||
|
||||
const cadStore = useCADStore()
|
||||
|
||||
// 从配置文件获取默认参数
|
||||
const configDefaults = getGeometryOptimizationDefaults()
|
||||
|
||||
// 当前参数
|
||||
const parameters = ref({
|
||||
software_type: configDefaults.SOFTWARE_TYPE,
|
||||
project_name: props.subassemblyPath || window.appState?.currentProject?.name || 'Unknown Project',
|
||||
project_name: props.subassemblyPath || cadStore.currentProjectName || 'Unknown Project',
|
||||
method: configDefaults.METHOD,
|
||||
quality: configDefaults.QUALITY,
|
||||
chord_height: configDefaults.CHORD_HEIGHT,
|
||||
fill_holes: configDefaults.FILL_HOLES,
|
||||
ignore_small_surfaces: configDefaults.IGNORE_SMALL_SURFACES,
|
||||
small_surface_percentage: configDefaults.SMALL_SURFACE_PERCENTAGE,
|
||||
output_file_path: '自定义名字',
|
||||
output_file_path: props.subassemblyPath ? props.subassemblyPath.split('/').pop() : (cadStore.currentProjectName || ''),
|
||||
output_type: configDefaults.OUTPUT_TYPE,
|
||||
ignore_quilts: configDefaults.IGNORE_QUILTS,
|
||||
ignore_skeleton: configDefaults.IGNORE_SKELETON,
|
||||
@ -263,10 +266,15 @@ const selectMethod = (method) => {
|
||||
|
||||
// 开始几何优化
|
||||
const startOptimization = async () => {
|
||||
// 构建API参数,使用"通过接口获取"作为project_name的占位符
|
||||
// 获取根项目名称
|
||||
const rootProjectName = cadStore.currentProjectName || parameters.value.project_name || "current_model"
|
||||
|
||||
// 构建API参数
|
||||
const apiParams = {
|
||||
software_type: parameters.value.software_type,
|
||||
project_name: "通过接口获取",
|
||||
// 如果是子装配体模式,project_name 应该是根装配体名称,component_path 才是子装配体路径
|
||||
// 如果是全模型模式,project_name 就是当前模型名称
|
||||
project_name: rootProjectName,
|
||||
method: parameters.value.method,
|
||||
quality: parameters.value.quality,
|
||||
chord_height: parameters.value.chord_height,
|
||||
@ -280,10 +288,9 @@ const startOptimization = async () => {
|
||||
assign_mass_properties: parameters.value.assign_mass_properties
|
||||
}
|
||||
|
||||
// 如果项目名称不是'Unknown Project',则认为是子装配体路径,添加参数
|
||||
if (parameters.value.project_name !== 'Unknown Project') {
|
||||
// 增加一个参数,参数值为项目名称的值 (即传过来的路径)
|
||||
apiParams.component_path = parameters.value.project_name
|
||||
// 如果存在子装配体路径,添加 component_path 参数
|
||||
if (props.subassemblyPath) {
|
||||
apiParams.component_path = props.subassemblyPath
|
||||
}
|
||||
|
||||
// 调用API
|
||||
@ -293,6 +300,33 @@ const startOptimization = async () => {
|
||||
emit('start-optimization', { result, parameters: { ...parameters.value } })
|
||||
}
|
||||
|
||||
// 组件挂载时检查项目名称
|
||||
onMounted(async () => {
|
||||
// 如果不是子装配体模式,且没有项目名称,尝试获取
|
||||
if (!props.subassemblyPath && (!cadStore.currentProjectName || parameters.value.project_name === 'Unknown Project')) {
|
||||
try {
|
||||
const result = await creoApi.getCurrentModel()
|
||||
if (result.success && result.data && result.data.data) {
|
||||
const fileName = result.data.data.fileName
|
||||
if (fileName) {
|
||||
// 更新Store
|
||||
cadStore.setCurrentProjectName(fileName)
|
||||
|
||||
// 更新当期页面参数
|
||||
parameters.value.project_name = fileName
|
||||
// 如果输出路径为空或者也是未名,则更新
|
||||
if (!parameters.value.output_file_path || parameters.value.output_file_path === 'Unknown Project') {
|
||||
parameters.value.output_file_path = fileName
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Failed to auto-fetch project name', e)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@ -2,6 +2,7 @@ import { createApp } from 'vue'
|
||||
import { createPinia } from 'pinia'
|
||||
import ElementPlus from 'element-plus'
|
||||
import 'element-plus/dist/index.css'
|
||||
import '@fortawesome/fontawesome-free/css/all.css'
|
||||
|
||||
import App from './App.vue'
|
||||
import router from './router'
|
||||
|
||||
Loading…
Reference in New Issue
Block a user