CATIA VBA DrawingView .X .xAxisData 比较分析

* Property xAxisData( ) As double:

 This property returns or sets the x coordinate of the drawing view's coordinate system origin, expressed in millimeters with respect to the sheet coordinate system. This method is not available with 2D Layout for 3D Design.


Example:

 Retrieves the x coordinate of the coordinate system origin of the MyView drawing view: X = MyView.xAxisData


* Property x( ) As double:

 For an interactive view, the get_x and put_x methods are equivalents to get_xAxisData and put_xAxisData. In a generative case, get_x and put_x return or set the x coordinate of the projection of the 3D centre of gravity, expressed in millimeters with respect to the sheet coordinate system. This method is not available with 2D Layout for 3D Design.


* Property yAxisData( ) As double:

 This property returns or sets the y coordinate of the drawing view's coordinate system origin, expressed in millimeters with respect to the sheet coordinate system. This method is not available with 2D Layout for 3D Design.


Example:

 Sets the y coordinate of the coordinate system origin of the MyView drawing view to 5 inches. NewYCoordinate = 5*25.4 MyView.yAxisData = NewYCoordinate


* Property y( ) As double:

 For an interactive view, the get_y and put_y methods are equivalents to get_yAxisData and put_yAxisData. In a generative case, get_y and put_y return or set the y coordinate of the projection of the 3D centre of gravity, expressed in millimeters with respect to the sheet coordinate system. This method is not available with 2D Layout for 3D Design.


The above is the official API documentation. The specific comparison effect is as follows:


Using .xAxisData .yAxisData

factory.CreateCircle oXY(0) - view.xAxisData, oXY(2) - view.yAxisData, 3, 0, 2 * Dpi

factory.CreateCircle oXY(0) - view.xAxisData, oXY(3) - view.yAxisData, 3, 0, 2 * Dpi

factory.CreateCircle oXY(1) - view.xAxisData, oXY(2) - view.yAxisData, 3, 0, 2 * Dpi

factory.CreateCircle oXY(1) - view.xAxisData, oXY(3) - view.yAxisData, 3, 0, 2 * Dpi


Using .X .Y

factory.CreateCircle oXY(0) - view.X, oXY(2) - view.Y, 3, 0, 2 * Dpi

factory.CreateCircle oXY(0) - view.X, oXY(3) - view.Y, 3, 0, 2 * Dpi

factory.CreateCircle oXY(1) - view.X, oXY(2) - view.Y, 3, 0, 2 * Dpi

factory.CreateCircle oXY(1) - view.X, oXY(3) - view.Y, 3, 0, 2 * Dpi


It can be seen that .xAxisData .yAxisData represents the center of the view, while .X .Y refers to the origin position of the 3D graphics corresponding to the view.


The complete .xAxisData .yAxisData code reference is as follows, and .X .Y can be handled similarly:


Sub testCarLine()

   Dim sheet As DrawingSheet

   Set sheet = CATIA.ActiveDocument.Sheets.ActiveSheet

   Dim mainView As DrawingView

   Set mainView = sheet.Views.Item(1)

   mainView.Activate

   

   For i = 3 To sheet.Views.Count

       Set view = sheet.Views.Item(i)

       drawCircles view

   Next

End Sub


Sub drawCircles(view)

   Dim oXY(4)

   view.SIZE oXY()

   

   Dim factory As Factory2D

   Set factory = view.Factory2D  


   view.Activate


   factory.CreateCircle oXY(0) - view.xAxisData, oXY(2) - view.yAxisData, 3, 0, 2 * Dpi

   factory.CreateCircle oXY(0) - view.xAxisData, oXY(3) - view.yAxisData, 3, 0, 2 * Dpi

   factory.CreateCircle oXY(1) - view.xAxisData, oXY(2) - view.yAxisData, 3, 0, 2 * Dpi

   factory.CreateCircle oXY(1) - view.xAxisData, oXY(3) - view.yAxisData, 3, 0, 2 * Dpi

End Sub


It's important to note that in the above code:

- The loop starting from 3 is because views.item(1) represents MainView and views.item(2) represents BackgroundView.

- The Dpi represents the pi radians.


Please use "DrawingView" in your program to avoid duplications while maintaining similar meanings.

QR Code
微信扫一扫,欢迎咨询~

联系我们
武汉格发信息技术有限公司
湖北省武汉市经开区科技园西路6号103孵化器
电话:155-2731-8020 座机:027-59821821
邮件:tanzw@gofarlic.com
Copyright © 2023 Gofarsoft Co.,Ltd. 保留所有权利
遇到许可问题?该如何解决!?
评估许可证实际采购量? 
不清楚软件许可证使用数据? 
收到软件厂商律师函!?  
想要少购买点许可证,节省费用? 
收到软件厂商侵权通告!?  
有正版license,但许可证不够用,需要新购? 
联系方式 155-2731-8020
预留信息,一起解决您的问题
* 姓名:
* 手机:

* 公司名称:

姓名不为空

手机不正确

公司不为空