文章目录
函数是否需要加括号type类型出现未定义变量类型错误,怎么破背景色设置检查模块是否封闭几何图形集是否存在某一个元素函数是否需要加括号
type类型
出现未定义变量类型错误,怎么破
背景色设置
背景色设置
Sub gg()Dim myviewer ' As Viewer3DSet myviewer = CATIA.ActiveWindow.ActiveViewerDim color(2)myviewer.GetBackgroundColor color '当前背景颜色,储存在color中,值为RGB/255,默认为0.2,0.2,0.4Dim arra(2)arra(0) = 0.2arra(1) = 0.2arra(2) = 0.4myviewer.PutBackgroundColor arraEnd Sub
Dim viewer1Private Sub CommandButton1_Click()Dim arra(2)arra(0) = 0.2arra(1) = 0.2arra(2) = 0.4viewer1.PutBackgroundColor arraEnd SubPrivate Sub CommandButton2_Click()Dim arra(2)arra(0) = 1arra(1) = 1arra(2) = 1viewer1.PutBackgroundColor arraEnd SubPrivate Sub CommandButton3_Click()If TextBox1.Value < 0 Or TextBox1.Value > 255 ThenMsgBox "请输入0-255之间的RGB值"Exit SubEnd IfIf TextBox2.Value < 0 Or TextBox2.Value > 255 ThenMsgBox "请输入0-255之间的RGB值"Exit SubEnd IfIf TextBox2.Value < 0 Or TextBox2.Value > 255 ThenMsgBox "请输入0-255之间的RGB值"Exit SubEnd IfDim arra(2)arra(0) = Val(TextBox1.Value) / 255arra(1) = Val(TextBox2.Value) / 255arra(2) = Val(TextBox3.Value) / 255viewer1.PutBackgroundColor arraEnd SubPrivate Sub UserForm_Initialize()Set viewer1 = CATIA.ActiveWindow.ActiveViewerEnd Sub
检查模块是否封闭
封闭模块,可以fill
Sub CheckFill() '(BoundaryObj As Variant) As BooleanInitCATIAPart FalseSet BoundaryObj = oHBodies.Item(1).HybridShapes.Item(5)Dim checkfOn Error GoTo NNNDim CF As HybridShapeFillSet CF = oHSF.AddNewFill()CF.AddBound BoundaryObjoHBodies.Item(1).AppendHybridShape CFoPart.UpdateObject CFcheckf = TrueExit SubNNN:checkf = FalseEnd Sub
几何图形集是否存在某一个元素
Attribute VB_Name = "Module3"Function HybridShapeExists(InputStr As String) As BooleanOn Error GoTo blastSet curset = hybody1Set HHH = curset.HybridShapes.Item(InputStr)HybridShapeExists = TrueExit Functionblast:HybridShapeExists = FalseEnd FunctionSub f()init1Call HybridShapeExists("Point.3")End Sub
catia二次开发:函数是否需要加括号 type类型 出现未定义变量类型错误 怎么破 背景色设置 检查模块是否封闭 几何图形集是否存在某一个元素