Let's create a code to get the volume value of the model by changing the dimension value. The dimension value is defined as width * length * height. The dimension values have a changeable range. Let's create a predictable function with AI.
number | width | length | height | volume(mm^3) |
1 | 50 | 30 | 20 | 26,250 |
2 | 60 | 80 | 10 | 42,000 |
3 | 35 | 20 | 60 | 36,750 |
If you pass 10,000 changed values and Volume values of the model to AI, it will create a function. If you set the range of input values, you can create a combined data set.
Wow!
I created the pattern with the free version of claude.ai.
volume = width * height * length * 0.875
This is amazing. It's scary to find the pattern.
Sub CalculateVolume()
' 변수 선언
Dim width As Double
Dim height As Double
Dim length As Double
Dim volume As Double
' 사용자로부터 입력 받기
width = InputBox("너비(width)를 입력하세요 (mm):", "입력")
height = InputBox("높이(height)를 입력하세요 (mm):", "입력")
length = InputBox("길이(length)를 입력하세요 (mm):", "입력")
' 체적 계산 (mm³) - 0.875 계수 적용
volume = width * height * length * 0.875
' 결과 표시
MsgBox "계산된 체적(Volume)은 " & volume & " mm³ 입니다.", vbInformation, "결과"
' 워크시트에 결과 기록 (선택사항)
Call RecordResult(width, height, length, volume)
End Sub
Sub RecordResult(widthVal As Double, heightVal As Double, lengthVal As Double, volumeVal As Double)
Dim ws As Worksheet
Dim lastRow As Long
' 활성 워크시트 선택
Set ws = ActiveSheet
' 마지막 행 찾기
lastRow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row + 1
' 결과 기록
ws.Cells(lastRow, 1).Value = lastRow - 1 ' number
ws.Cells(lastRow, 2).Value = widthVal ' width
ws.Cells(lastRow, 3).Value = lengthVal ' length
ws.Cells(lastRow, 4).Value = heightVal ' height
ws.Cells(lastRow, 5).Value = volumeVal ' volume(mm³)
End Sub
Cell 값을 조합하기
3개 이상을 조합하는것 가능하나, 시스템이 다운 될수 있습니다codeSub 모든조합() Dim lastRowA As Long, lastRowB As Long, lastRowC As Long Dim i As Long, j As Long, k As Long, L As Long Dim ws As Worksheet Set ws = ThisWorkbook.She
tool-2020.tistory.com
무게와 관련된 매개변수
자동 무게 계산 프로그램 IpfcSolid.GetMassProperty() 부품 또는 어셈블리의 질량 분포에 대한 정보를 제공합니다. 다음과 같은 Mass Property Object를 리턴 합니다. 계산을 위한 좌표계가 필요 합니다. 좌표
tool-2020.tistory.com
'VBA, VB.NET For Creo' 카테고리의 다른 글
Display all dimension names and values contained in a part file (0) | 2025.03.12 |
---|---|
How to display all model names in a session (0) | 2025.03.11 |
Output the currently active 3D model name (0) | 2025.03.11 |
Installation and setup for using Creo VBA (0) | 2025.03.10 |
IpfcSurface (0) | 2025.02.01 |