|
|
马上注册,结识高手,享用更多资源,轻松玩转三维网社区。
您需要 登录 才可以下载或查看,没有帐号?注册
x
按照官网的代码写到宏里面的,实现FeatureManageTree运行时在Debug.Print "View dependencies = " & swFeatMgr.ViewDependencies出现错误,请问有遇到这种情况的吗?谢谢大家了'----------------------------------------------------' Preconditions:' 1. Specified document exists.' 2. Open the Immediate window.'' Postconditions:' 1. The FeatureManager design tree's display-related property' values are shown in the Immediate window.' 2. Examine both the Immediate window and the FeatureManager' design tree before resuming the macro.' 3. Re-examine both the Immediate window the ' FeatureManager design tree to verify the changes.'' NOTE: Because this assembly document is used' elsewhere, do not save any changes when closing it.'----------------------------------------------------Option ExplicitDim swApp As SldWorks.SldWorksDim swModelDoc As SldWorks.ModelDoc2Dim swFeatMgr As SldWorks.FeatureManagerDim document As StringDim errors As LongDim warnings As LongSub main()document = "C:\Program Files\SolidWorks Corp\SolidWorks\samples\tutorial\advdrawings\bladed shaft.sldasm"Set swApp = Application.SldWorksSet swModelDoc = swApp.OpenDoc6(document, swDocASSEMBLY, swOpenDocOptions_Silent, "", errors, warnings)Set swFeatMgr = swModelDoc.FeatureManagerDebug.Print "----------------- Before changing FeatureManager design tree properties -----------------"Debug.Print "View dependencies = " & swFeatMgr.ViewDependenciesDebug.Print "View features = " & swFeatMgr.ViewFeaturesDebug.Print "Show feature details = " & swFeatMgr.ShowFeatureDetailsDebug.Print "Show hierarchy only = " & swFeatMgr.ShowHierarchyOnlyStop' Examine the Immediate window and' FeatureManager design tree before' resuming the macro' Change details, dependencies, hierarchy, and' features-related properties If (swFeatMgr.ViewDependencies) Then swFeatMgr.ViewFeatures = True Else swFeatMgr.ViewDependencies = True End If If (swFeatMgr.ShowFeatureDetails) Then swFeatMgr.ShowHierarchyOnly = True Else swFeatMgr.ShowFeatureDetails = True End If Debug.Print "----------------- After changing FeatureManager design tree properties -----------------"Debug.Print "View dependencies = " & swFeatMgr.ViewDependenciesDebug.Print "View features = " & swFeatMgr.ViewFeaturesDebug.Print "Show feature details = " & swFeatMgr.ShowFeatureDetailsDebug.Print "Show hierarchy only = " & swFeatMgr.ShowHierarchyOnlyEnd Sub |
|