Weldment API Problem in Windows 7 x64
Weldment API Problem in Windows 7 x64
(OP)
Hi, I know this is pretty new but I am using solidworks 2009 SP3 in windows 7 Build 7100 and a macro , the same one the api help files shows as an example, stop workind in this windows, even in vista x64 it works, Is there anyone with the same problem or maybe a solution. The code is this one.
thanks.
Option Explicit
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swModelDocExt As SldWorks.ModelDocExtension
Dim swSelMgr As SldWorks.SelectionMgr
Dim swWeldFeat As SldWorks.Feature
Dim swWeldFeatData As SldWorks.StructuralMemberFeatureData
Dim boolstatus As Boolean
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swSelMgr = swModel.SelectionManager
Set swModelDocExt = swModel.Extension
boolstatus = swModelDocExt.SelectByID2("Structural Member1", "BODYFEATURE", 0, 0, 0, False, 0, Nothing, 0)
Set swWeldFeat = swSelMgr.GetSelectedObject6(1, 0)
Set swWeldFeatData = swWeldFeat.GetDefinition
swWeldFeatData.AccessSelections swModel, Nothing
**************************************************************
it stop working in this line !!!!!!!
**************************************************************
swWeldFeatData.WeldmentProfilePath = "C:\Program Files\SolidWorks_2006_sp0\data\weldment profiles\iso\pipe\26.9 x 3.2.sldlfp"
boolstatus = swWeldFeat.ModifyDefinition(swWeldFeatData, swModel, Nothing)
End Sub
thanks.
Option Explicit
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swModelDocExt As SldWorks.ModelDocExtension
Dim swSelMgr As SldWorks.SelectionMgr
Dim swWeldFeat As SldWorks.Feature
Dim swWeldFeatData As SldWorks.StructuralMemberFeatureData
Dim boolstatus As Boolean
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swSelMgr = swModel.SelectionManager
Set swModelDocExt = swModel.Extension
boolstatus = swModelDocExt.SelectByID2("Structural Member1", "BODYFEATURE", 0, 0, 0, False, 0, Nothing, 0)
Set swWeldFeat = swSelMgr.GetSelectedObject6(1, 0)
Set swWeldFeatData = swWeldFeat.GetDefinition
swWeldFeatData.AccessSelections swModel, Nothing
**************************************************************
it stop working in this line !!!!!!!
**************************************************************
swWeldFeatData.WeldmentProfilePath = "C:\Program Files\SolidWorks_2006_sp0\data\weldment profiles\iso\pipe\26.9 x 3.2.sldlfp"
boolstatus = swWeldFeat.ModifyDefinition(swWeldFeatData, swModel, Nothing)
End Sub






RE: Weldment API Problem in Windows 7 x64
RE: Weldment API Problem in Windows 7 x64
Automation Error
RE: Weldment API Problem in Windows 7 x64
RE: Weldment API Problem in Windows 7 x64
RE: Weldment API Problem in Windows 7 x64
Dim [varname] As [vartype]
When you declare an object variable, you can either tell VBA straight up what type of object you expect, like
Dim swApp As SldWorks.Application
or you can let VBA figure it out on its own by declaring like
Dim swApp As Object.
This makes VBA figure out what kind of object it has once it gets it.
If you use the second method, it's called "late binding". The first method is called "early binding". Each has its pros/cons.
-handleman, CSWP (The new, easy test)
RE: Weldment API Problem in Windows 7 x64
RE: Weldment API Problem in Windows 7 x64
'-------------------------------------------------
'
' Preconditions: Assembly document open that has part with a feature named Structural Member1.
'
' Postconditions: Profile changed to profile specified in macro.
'
'--------------------------------------------------
Option Explicit
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swModelDocExt As SldWorks.ModelDocExtension
Dim swSelMgr As SldWorks.SelectionMgr
Dim swWeldFeat As SldWorks.Feature
Dim swWeldFeatData As SldWorks.StructuralMemberFeatureData
Dim boolstatus As Boolean
Dim swComp As SldWorks.Component2
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swSelMgr = swModel.SelectionManager
Set swModelDocExt = swModel.Extension
'select your structural member
Set swWeldFeat = swSelMgr.GetSelectedObject6(1, 0)
Set swComp = swSelMgr.GetSelectedObjectsComponent3(1, 0)
Set swWeldFeatData = swWeldFeat.GetDefinition
swWeldFeatData.AccessSelections swModel, swComp
swWeldFeatData.WeldmentProfilePath = "C:\Program Files\SolidWorks_2006_sp0\data\weldment profiles\iso\pipe\26.9 x 3.2.sldlfp"
boolstatus = swWeldFeat.ModifyDefinition(swWeldFeatData, swModel, swComp)
End Sub
RE: Weldment API Problem in Windows 7 x64
error '-2147417551 (80010105)':
Automation Error
when trying to execute
swWeldFeatData.WeldmentProfilePath = "C:\Program Files\SolidWorks_2006_sp0\data\weldment profiles\iso\pipe\26.9 x 3.2.sldlfp"
P.S: I changed the Path to a valid one.
Debug.Print Err returned -2147417851
RE: Weldment API Problem in Windows 7 x64
Bdw. is crashing if I change weldment profile path in part doc, but assembly doc is working here without problems.
RE: Weldment API Problem in Windows 7 x64
RE: Weldment API Problem in Windows 7 x64
RE: Weldment API Problem in Windows 7 x64
RE: Weldment API Problem in Windows 7 x64
RE: Weldment API Problem in Windows 7 x64
Yes I am happy and yes there is a conversion problem..
All I have to do is make the base parts again but those are very easy to do...
Thank you a lot!!!!!
:)