vb代码调用solidworks提示缺少参数'part.parameter(...)'
如题。代码如下:
Dim swApp
Dim PART
DIM filename
On Error Resume Next
Set swapp = GetObject(, "SldWorks.Application")
If Err Then
Err.Clear
Set swApp = CreateObject("SldWorks.Application")
Set Part = swApp.ActiveDoc
swApp.Visible = true
swApp.UserControl = True
End If
Set objFSO = CreateObject("Scripting.FileSystemObject")
filename = objFSO.getAbsolutePathName(".") & "\opt.SLDPRT"
'Set objFile = objFSO.GetFile("opt.SLDPRT")
Set PART = swApp.OpenDoc(filename)
swapp.ActivateDoc2 "opt"
Set PART = swApp.ActiveDoc
On Error GoTo 0
PART.Parameter("d5@sketch").SystemValue = 68 /1000
总是提示最后1行缺少参数。
谢谢各位老师指点。 楼主,我也想学基于VB的SW二次开发,能介绍些相关资料吗?谢谢 关于楼主遇到的这个问题。我先在也碰到了,很困惑。我的也是对一个尺寸驱动的零件进行参数化建模,接果报错。不知道楼主解决了没?能否传授些经验,谢谢! "d5@sketch"不存在吧,修改一下你的Solidwork全局变量 The Name argument for this method does not have to be the "full" dimension name. For example, you only need to pass "D1" not "D1@Base-Revolve". The full dimension name is required if you call IModelDoc2::Parameter.
SOLIDWORKS recognizes some characters as special characters. The use of these characters in part or feature names can cause this method to fail and not return a dimension. These special characters are not recognized in names of parts or features:
at sign ( @ )
period ( . )
backslash ( / )
页:
[1]