본문 바로가기
  • 환영 합니다 ! Welcome!
VBA For Creo

무게와 관련된 매개변수

by ToolBOX01 2021. 2. 15.
반응형

자동 무게 계산 프로그램

IpfcSolid.GetMassProperty()

부품 또는 어셈블리의 질량 분포에 대한 정보를 제공합니다. 다음과 같은 Mass Property Object를 리턴 합니다.

계산을 위한 좌표계가 필요 합니다. 좌표계 이름을 정의 해야 합니다

 

1. The volume.

2. The surface area.

3. The density. The density value is 1.0, unless a material has been assigned.

4. The mass.

5. The center of gravity (COG).

6. The inertia matrix.

7. The inertia tensor.

8. The inertia about the COG.

9. The principal moments of inertia (the eigen values of the COG inertia).

10. The principal axes (the eigenvectors of the COG inertia).


The volume. 알아보기

 

 

        Dim model As IpfcModel
        Set model = session.CurrentModel
        
        Dim oSolid As IpfcSolid
        Set oSolid = model
        Dim oMassProperty As IpfcMassProperty
        Dim oVolume As Double
        
        Set oMassProperty = oSolid.GetMassProperty("PRT_CSYS_DEF")
        oVolume = oMassProperty.Volume
        MsgBox  oVolume
        

 

 

The surface area. 알아보기

 

 

        Dim model As IpfcModel
        Set model = session.CurrentModel
        
        Dim oSolid As IpfcSolid
        Set oSolid = model
        Dim oMassProperty As IpfcMassProperty
        Dim oSurfaceArea As Double
        
        Set oMassProperty = oSolid.GetMassProperty("PRT_CSYS_DEF")
        oSurfaceArea = oMassProperty.SurfaceArea
        MsgBox  oVolume

 

 

The density 알아보기

 

        Dim model As IpfcModel
        Set model = session.CurrentModel
        
        Dim oSolid As IpfcSolid
        Set oSolid = model
        Dim oMassProperty As IpfcMassProperty
        Dim oDensity As Double
        
        Set oMassProperty = oSolid.GetMassProperty("PRT_CSYS_DEF")
        oDensity = oMassProperty.Density
        MsgBox  oDensity

 

 

The mass. 알아보기

 

        Dim model As IpfcModel
        Set model = session.CurrentModel
        
        Dim oSolid As IpfcSolid
        Set oSolid = model
        Dim oMassProperty As IpfcMassProperty
        Dim oMass As Double
        
        Set oMassProperty = oSolid.GetMassProperty("PRT_CSYS_DEF")
        oMass = oMassProperty.Mass
        MsgBox  oMass

 

 

무게 중심(GravityCenter) 위치 알아보기

 

가로* 세로 * 높이 값은 모두 "10"입니다. 좌표계 x, y는  양수 방향, z는 음수 방향으로  솔리드 형상을 만들었습니다.

리턴값은 배열이며 3개의 값을 제공 합니다.

 

        Dim model As IpfcModel
        Set model = session.CurrentModel
        
        Dim oSolid As IpfcSolid
        Set oSolid = model
        Dim oMassProperty As IpfcMassProperty
        Dim oPoint3D As IpfcPoint3D
        
        Set oMassProperty = oSolid.GetMassProperty("PRT_CSYS_DEF")
        Set oPoint3D = oMassProperty.GravityCenter
      
        'x방향
        MsgBox oPoint3D.Item(0)
        'y방향
        MsgBox oPoint3D.Item(1)
        'z방향
        MsgBox oPoint3D.Item(2)

 

 

The principal moments of inertia (the eigen values of the COG inertia).알아보기

주요 관성 모멘트 (CenterGravityInertiaTensor의 고유 값)

 

creo 화면

 

 

 

        Dim model As IpfcModel
        Set model = session.CurrentModel
        
        Dim oSolid As IpfcSolid
        Set oSolid = model
        Dim oMassProperty As IpfcMassProperty
        Dim oPoint3D As IpfcVector3D
        
        Set oMassProperty = oSolid.GetMassProperty("PRT_CSYS_DEF")
        Set oPoint3D = oMassProperty.PrincipalMoments
      
        MsgBox oPoint3D.Item(0)
        MsgBox oPoint3D.Item(1)
        MsgBox oPoint3D.Item(2)

 

 

The inertia about the COG. 알아보기 

무게 중심으로 변환 된 관성 텐서

 

CREO 모델 분석

 

 

        Dim model As IpfcModel
        Set model = session.CurrentModel
        
        Dim oSolid As IpfcSolid
        Set oSolid = model
        Dim oMassProperty As IpfcMassProperty
        Dim oInertia As IpfcInertia
        
        Set oMassProperty = oSolid.GetMassProperty("PRT_CSYS_DEF")
        Set oInertia = oMassProperty.CenterGravityInertiaTensor
         
        'Ixx Ixy Ixz
        MsgBox oInertia.Item(0, 0)
        MsgBox oInertia.Item(0, 1)
        MsgBox oInertia.Item(0, 2)
        
        'Iyx Iyy Iyz
        MsgBox oInertia.Item(1, 0)
        MsgBox oInertia.Item(1, 1)
        MsgBox oInertia.Item(1, 2)
        
        'Izx Izy Izz
        MsgBox oInertia.Item(2, 0)
        MsgBox oInertia.Item(2, 1)
        MsgBox oInertia.Item(2, 2)

 

 

The inertia tensor. 알아보기

좌표 프레임에 대한 관성 텐서 : CoordSysInertiaTensor = trace (CoordSysInertia) * identity-CoordSysInertia

 

 

모델 분석

 

 

        Dim model As IpfcModel
        Set model = session.CurrentModel
        
        Dim oSolid As IpfcSolid
        Set oSolid = model
        Dim oMassProperty As IpfcMassProperty
        Dim oInertia As IpfcInertia
        
        Set oMassProperty = oSolid.GetMassProperty("PRT_CSYS_DEF")
        Set oInertia = oMassProperty.CoordSysInertiaTensor
         
        'Ixx Ixy Ixz
        MsgBox oInertia.Item(0, 0)
        MsgBox oInertia.Item(0, 1)
        MsgBox oInertia.Item(0, 2)
        'Iyx Iyy Iyz
        MsgBox oInertia.Item(1, 0)
        MsgBox oInertia.Item(1, 1)
        MsgBox oInertia.Item(1, 2)
        'Izx Izy Izz
        MsgBox oInertia.Item(2, 0)
        MsgBox oInertia.Item(2, 1)
        MsgBox oInertia.Item(2, 2)

 

위 코드를 사용 하면 모델에서 재질 특성을 자동으로 가져 올수 있다. 수백개의 모델 무게와 관성 모우멘트 값을

자동으로 표시 할수 있다. 외국의 사례에서 위 기능들을 이용 하여, 공용 데이터 검색에 사용한다. 자신의 만든 모델과

과거 데이터들과 비교하여 95% 이상 동일한 부품을 보이게 할수 있다. 부품 고용화를 향상 시킬수 있다.

무게는 밀도 값과 연계 되어 있고, 밀도값은 재질을 선택 하면 자동으로 Croe 파일에 저장된다.

 

비즈니스 문의 : lionkk@idt21c.com