swModel.SketchManager.AddToDB = True

220 views
Skip to first unread message

Ed

unread,
May 10, 2009, 9:56:01 AM5/10/09
to SolidWorks-API

I get an error 91 when I click the cmdBuild button.

Object Variable or with block variable not set.

swModel.SketchManager.AddToDB = True
So each word after the . notation was inserted...
they must be correct right,If it pops up after the . and you insert
it....
Object...swModel
variable...SketckManager
member...AddTo DB


We Dim...(define) the object right... then select a Method and a
value...?

I don't understand what's wrong here?

Private Sub cmdBuild_Click()
Set swApp = Application.SldWorks
Set swModel = swApp.NewDocument(filedir + _
"APIPart.prtdot", 0, 0#, 0#)
swModel.SketchManager.AddToDB = True

swModel.SetUserPreferenceIntegerValue swUnitsLinear, swMM

'MATERIAL
If optAl.Value = True Then
swModel.SetUserPreferenceDoubleValue _
SwConst.swMaterialPropertyDensity, 2700
swModel.SetUserPreferenceStringValue _
SwConst.swMaterialPropertyCrosshatchPattern, _
"ISO (Aluminum)"
Else
swModel.SetUserPreferenceDoubleValue _
SwConst.swMaterialPropertyDensity, 8600
swModel.SetUserPreferenceStringValue _
SwConst.swMaterialPropertyCrosshatchPattern, _
"ISO (Bronze Brass)"
End If

Corey Scheich

unread,
May 16, 2009, 9:54:30 PM5/16/09
to solidwo...@googlegroups.com
I would guess that filedir + "APIPart.prtdot" doesn't evaluate to a valid path to an existing Template file, so swModel still evaluates to Nothing.  Add it to a message box to validate the path.  

Corey

> Date: Sun, 10 May 2009 06:56:01 -0700
> Subject: swModel.SketchManager.AddToDB = True
> From: gree...@usfamily.net
> To: SolidWo...@googlegroups.com

Hotmail® goes with you. Get it on your BlackBerry or iPhone.
Reply all
Reply to author
Forward
0 new messages