|
please help me!i can't run it..
private sub command1_click()
dim swapp as object
dim part as object
dim selmgr as object
dim boolstatus as boolean
dim longstatus as long, longwarnings as long
dim feature as object
dim m as single
dim d as single
dim p as single
dim q as single
dim q1 as single
dim qq as single
dim sweepfeature as object
dim x1 as single
dim x2 as single
set swapp = createobject("sldworks.application")
set part = swapp.newdocument("d:\program files\solidworks\lang\chinese-simplified\tutorial\part.prtdot", 0, 0#, 0#)
set part = swapp.activatedoc2("part1", false, longstatus)
set part = swapp.activedoc
set selmgr = part.selectionmanager
const pi = 3.141592654
m = 20 '????
d = 2 '????
p = 6 '??
q = 25 '??????,??????
q1 = 2 '????????
qq = 2 * q1
'h = p * q + q1 * d * 2 '????,q????
'?????
'???
boolstatus = part.extension.selectbyid2("?????", "plane", 0, 0, 0, false, 0, nothing, 0)
part.sketchmanager.insertsketch true
part.clearselection2 true
part.createcircle 0, m / 2, 0, 0, m / 2 + d / 2, 0
'???
boolstatus = part.extension.selectbyid2("?????", "plane", 0, 0, 0, false, 0, nothing, 0)
part.sketchmanager.insertsketch true
part.clearselection2 true
part.createcircle 0, 0, 0, m / 2, 0, 0
'?????
part.inserthelix false, false, false, true, 0, 0.01875, p, q, 0, 1.570796326795
'??????
'???
boolstatus = part.extension.selectbyid2("?????", "plane", 0, 0, 0, false, 0, nothing, 0)
part.sketchmanager.insertsketch true
part.clearselection2 true
part.createcircle -p * q, m / 2, 0, -p * q, m / 2 + d / 2, 0
part.clearselection2 true
'?????
boolstatus = part.extension.selectbyid2("?????", "plane", 0, 0, 0, false, 0, nothing, 0)
part.createplaneatoffset3 p * q, false, true
part.clearselection2 true
part.sketchmanager.insertsketch true
'???
boolstatus = part.extension.selectbyid2("???1", "plane", 0, 0, 0, false, 0, nothing, 0)
part.sketchmanager.insertsketch true
part.clearselection2 true
part.createcircle 0, 0, 0, m / 2, 0, 0
'?????
part.inserthelix false, false, false, true, 0, 0.01875, d + 0.05, qq, 0, 1.570796326795
'??????
'???
boolstatus = part.extension.selectbyid2("?????", "plane", 0, 0, 0, false, 0, nothing, 0)
part.sketchmanager.insertsketch true
part.clearselection2 true
part.createcircle 0, m / 2, 0, 0, m / 2 + d / 2, 0
'???
boolstatus = part.extension.selectbyid2("?????", "plane", 0, 0, 0, false, 0, nothing, 0)
part.sketchmanager.insertsketch true
part.clearselection2 true
part.createcircle 0, 0, 0, m / 2, 0, 0
'?????
part.inserthelix true, true, false, true, 0, 0.01875, d + 0.05, qq, 0, 1.570796326795
'?????????
boolstatus = part.extension.selectbyid2("??1", "sketch", 0, 0, 0, false, 1, nothing, 0)
boolstatus = part.extension.selectbyid2("???/???1", "referencecurves", 0, 0, 0, true, 4, nothing, 0)
set sweepfeature = part.featuremanager.insertprotrusionswept3(false, false, 0, false, false, 0, 0, false, 0, 0, 0, 0, 1, 1, 1, 0, 1)
'??????????
boolstatus = part.extension.selectbyid2("??3", "sketch", 0, 0, 0, false, 1, nothing, 0)
boolstatus = part.extension.selectbyid2("???/???2", "referencecurves", 0, 0, 0, true, 4, nothing, 0)
set sweepfeature = part.featuremanager.insertprotrusionswept3(false, false, 0, false, false, 0, 0, false, 0, 0, 0, 0, 1, 1, 1, 0, 1)
'??????????
boolstatus = part.extension.selectbyid2("??5", "sketch", 0, 0, 0, false, 1, nothing, 0)
boolstatus = part.extension.selectbyid2("???/???3", "referencecurves", 0, 0, 0, true, 4, nothing, 0)
set sweepfeature = part.featuremanager.insertprotrusionswept3(false, false, 0, false, false, 0, 0, false, 0, 0, 0, 0, 1, 1, 1, 0, 1)
'????
boolstatus = part.extension.selectbyid2("?????", "plane", 0, 0, 0, false, 0, nothing, 0)
part.sketchmanager.insertsketch true
part.clearselection2 true
x1 = (d * qq) / 2
x2 = x1 + d * qq * 2
part.createline2 x1, (m + d) / 2, 0, x2, (m + d) / 2, 0
part.createline2 x2, (m + d) / 2, 0, x2, -(m + d) / 2, 0
part.createline2 x2, -(m + d) / 2, 0, x1, -(m + d) / 2, 0
part.createline2 x1, -(m + d) / 2, 0, x1, (m + d) / 2, 0
x1 = -p * q - (d * qq) / 2
x2 = x1 - d * qq * 2
part.createline2 x1, (m + d) / 2, 0, x2, (m + d) / 2, 0
part.createline2 x2, (m + d) / 2, 0, x2, -(m + d) / 2, 0
part.createline2 x2, -(m + d) / 2, 0, x1, -(m + d) / 2, 0
part.createline2 x1, -(m + d) / 2, 0, x1, (m + d) / 2, 0
part.clearselection2 true
boolstatus = part.extension.selectbyid2("line8", "sketchsegment", 0, 0, 0, false, 0, nothing, 0)
part.featuremanager.featurecut true, false, false, 6, 0, m + d, 0.01, false, false, false, false, 0.01745329251994, 0.01745329251994, false, false, false, false, 0, 1, 1
part.selectionmanager.enablecontourselection = 0
'??
boolstatus = part.setuserpreferencetoggle(198, true)
part.shownamedview2 "*???????", 8
part.viewzoomtofit2
'?sw???dwg??,*???????/1000,??1:1??
end sub
hi yang,
you need to help us help you here...
first of all you need to replace the "?" with what they are meant to be and also it would be good if you could indicate where you get the runtime error...
cheers,
--stav.
in this world i am nobody...
and nobody is perfect ;) !!!
---------
solidworks office 2008 sp4.0
dell precision pws390
nvidia quadro fx 3450/4000 sdi
yang,
is this from the english version of solidworks? maybe the copy/paste into the forum changed all the foreign characters to ??? marks.
cswp
solidworks office professional 2008, sp 3.1
pc #1:
dell precision t3400, core2duo 2.33ghz, 4gb ram,
nvidia quadro fx 1700
pc #2:
dell precision 380, p4 3.80ghz, 2gb ram,
nvidia quadro fx 1400
quick |
|