7/23/2019 VBA4 Solidwork Base Model
http://slidepdf.com/reader/full/vba4-solidwork-base-model 1/18
VBA with SOLIDWORKS
(Base Solid Model)
Lecture 6 1Lecture 1
7/23/2019 VBA4 Solidwork Base Model
http://slidepdf.com/reader/full/vba4-solidwork-base-model 2/18
Basic Procedure
. e e p ane
2. Draw the profiles using sketchen es
3. Create the base model
(Step 1 and 2: has learnt from previous
slide)
Lecture 6 2
7/23/2019 VBA4 Solidwork Base Model
http://slidepdf.com/reader/full/vba4-solidwork-base-model 3/18
Extruded: Refresher
Lecture 6 3
7/23/2019 VBA4 Solidwork Base Model
http://slidepdf.com/reader/full/vba4-solidwork-base-model 4/18
Extruded Base Model
p ea = ea ure anager. ea ure x rus on s , p, r, ,
t2, d1, d2, dchk1, dchk2, ddir1, ddir2, dang1, dang2,offsetReverse1, offsetReverse2, translateSurface1,translateSurface2 mer e useFeatSco e useAutoSelectt0, startOffset, flipStartOffset )
sd: TRUE: single ended FALSE: double ended
flip TRUE to flip the direction to cut (not applicable forbase mode)
dir TRUE to flip the direction to extrude
t1
t2
Lecture 6 4
7/23/2019 VBA4 Solidwork Base Model
http://slidepdf.com/reader/full/vba4-solidwork-base-model 5/18
pFeat = FeatureManager.FeatureExtrusion2 ( sd, flip, dir, t1, t2,d1, d2, dchk1, dchk2, ddir1, ddir2, dang1, dang2,offsetReverse1, offsetReverse2, translateSurface1,
, , , , ,startOffset, flipStartOffset )
d1 in meters ddir1: TRUE: inward
dchk1: TRUE fordrafting
FALSE: outward
dang1: draft angle
d2 in meters
dchk2: TRUE for
ddir2: TRUE: inward
FALSE: outward
Lecture 6 5
dang2: draft angle
7/23/2019 VBA4 Solidwork Base Model
http://slidepdf.com/reader/full/vba4-solidwork-base-model 6/18
=
Parameters: default values
t2, d1, d2, dchk1, dchk2, ddir1, ddir2, dang1, dang2,offsetReverse1, offsetReverse2, translateSurface1,translateSurface2, merge, useFeatScope, useAutoSelect,
, ,
OffsetReverse1 False, OffsetReverse2 False,
trabslateSurface1 False, translateSurface2 False,, ,
useAutoSelect: False t0 0startOffset: 0 flipStartOffset: False
Set base = Part.FeatureManager.FeatureExtrusion2(True,False, False, 0, 0, 10, 0, False, False, False, False, 0, 0, False,False, False, False, False, False, False, 0, 0, False)
Example: extrude.swp
Lecture 6 6
7/23/2019 VBA4 Solidwork Base Model
http://slidepdf.com/reader/full/vba4-solidwork-base-model 7/18
Revolved Base Model
Axis of revolutionBase Profile
Dim line1, line2, line3, line4, consline As Object
Set line1 = Part.CreateLine2(5, 5, 0, 5, -5, 0) = - - -. , , , , ,
Set line3 = Part.CreateLine2(-5, -5, 0, -5, 5, 0)Set line4 = Part.CreateLine2(-5, 5, 0, 5, 5, 0)Set consline = Part.CreateLine2(10, 5, 0, 10, -
consline.ConstructionGeometry = True
Lecture 6 7
7/23/2019 VBA4 Solidwork Base Model
http://slidepdf.com/reader/full/vba4-solidwork-base-model 8/18
Revolved Base Model
5
10
Lecture 6 8
7/23/2019 VBA4 Solidwork Base Model
http://slidepdf.com/reader/full/vba4-solidwork-base-model 9/18
Revolved Base Model
. , ,
angle2, revType, options, merge, useFeatScope, useAutoSel )
revType:
Angle1: in radian
swRevolveOneDirection
swRevolveTypeMidPlane
swRevolveTypeTwoDirection
reverseDir:
True: reverse the
Etc (refer to online help)
Other parameters
Angle2: in radianFalse: not
Options: 0
Merge: False
useFeatScope: False
Lecture 6 9
useAutoSel: False
7/23/2019 VBA4 Solidwork Base Model
http://slidepdf.com/reader/full/vba4-solidwork-base-model 10/18
revolve.swp
Revolved Base Model
Set base = Part.FeatureManager.FeatureRevolve(3.14, False, 0, swRevolveOneDirection, 0, False,a se, a se
Lecture 6 10
7/23/2019 VBA4 Solidwork Base Model
http://slidepdf.com/reader/full/vba4-solidwork-base-model 11/18
Thin Feature
FeatureRevolveThin(additional parameters:
thickness 1 and thickness 2)
FeatureExtrusion2(additional parameters:
Lecture 6 11
t c ness an t c ness
7/23/2019 VBA4 Solidwork Base Model
http://slidepdf.com/reader/full/vba4-solidwork-base-model 12/18
Create Sub Component
roce ure
1. Select the face where the profileso e rawn
2. Draw the profilesSimilar to the profile creation in sketch.
3. Create the model to cut or extrude
Lecture 6 12
7/23/2019 VBA4 Solidwork Base Model
http://slidepdf.com/reader/full/vba4-solidwork-base-model 13/18
Select the face to create the plane
.
boolstatus = Part.Extension.SelectByID2("", "FACE", 1,1, 0, False, 0, Nothing, 0)
2. Create the plane
Part.SketchManager.InsertSketch True
* The coordinate set in the selection set must be the point
on e n en e ace.
Lecture 6 13
7/23/2019 VBA4 Solidwork Base Model
http://slidepdf.com/reader/full/vba4-solidwork-base-model 14/18
Create the cut or extruded feature
. x ru e ea ure:use the FeatureExtrusion2 command
2. Cut feature: use FeatureCutpFeat = FeatureManager.FeatureCut ( sd, flip, dir, t1, t2, d1,d2, dchk1, dchk2, ddir1, ddir2, dang1, dang2, offsetReverse1,
, , ,normalCut, useFeatScope, useAutoSelect )
* all the parameters are similar to FeatureExtrusion2
Lecture 6 14
7/23/2019 VBA4 Solidwork Base Model
http://slidepdf.com/reader/full/vba4-solidwork-base-model 15/18
Example: cut feature
= "" " ". . , , , , , , ,Nothing, 0)
Part.SketchManager.InsertSketch True
Dim line2, line3, line4, line5, base2 As Object
Set line2 = Part.CreateLine2(-2, 1, 0, 2, 1, 0)
Set line3 = Part.CreateLine2(2, 1, 0, 2, 3, 0) . , , , - , ,
Set line5 = Part.CreateLine2(-2, 3, 0, -2, 1, 0)
Set base2 = Part.FeatureManager.FeatureCut(True, False, False,swEndCondThroughAll, 0, 0, 0, False, False, False, False, 0, 0, False,
False, False, False, 0, 1, 1)
Note: when swEndCondThroughAll (t1) is used, the distance to cut can be
Lecture 6 15
.
7/23/2019 VBA4 Solidwork Base Model
http://slidepdf.com/reader/full/vba4-solidwork-base-model 16/18
ShellPart.SketchRectan le -0.04 -0.04 0 0.04 0.04 0 1Part.FeatureManager.FeatureExtrusion2 True, False, False, 0, 0, 0.04, 0,
False, False, False, False, 0, 0, False, False, False, False, False, False,False, 0, 0, False
boolstatus = Part.Extension.SelectByID2("", "FACE", 0, 0.04, 0, False, 0,,
Part.InsertFeatureShell 0.005, False
Lecture 6 16
7/23/2019 VBA4 Solidwork Base Model
http://slidepdf.com/reader/full/vba4-solidwork-base-model 17/18
Assignment 2
r e e su rou ne a w rawthe linkages for the projects. The
,of orientation and insertion points.
Lecture 6 17
7/23/2019 VBA4 Solidwork Base Model
http://slidepdf.com/reader/full/vba4-solidwork-base-model 18/18
Major Project
our as s o wr e a program obuiltSet the point , determine
angle required.
Lecture 6 18