SolidWorks机械工程师网——最大的SolidWorks学习平台

 找回密码
 立即注册

QQ登录

只需一步,快速开始

12
返回列表 发新帖
楼主: lhw2031
打印 上一主题 下一主题

使用Visual Studio建立SolidWorks二次开发环境(VB.NET)

[复制链接]

4

主题

36

帖子

26

金币

天使

Rank: 2Rank: 2

积分
68
QQ
21#
发表于 2018-7-2 14:04:48 | 只看该作者

   经典图书
我刚学VB时也是用2010版的IDE,不过后来要再找载点有点花时间,所以就拿最新的版本来用
2017版可以选择需要的编译模组安装,不会一开始就这么肥大(虽然还是很佔空间...)

另外想问一下,你对异形孔精灵的API有了解吗?
我想要钻定位销孔,但是都弄不出来,最妙的是用录制巨集纪录动作后居然跟我说不能执行
阿不是SolidWorks自己建立的巨集吗?竟然还不能执行,有后虾的
API Help只有狭槽和沉头孔的范例,我有成功用API钻出沉头孔,但是定位销孔就是做不出来
SolidWorks机械工程师网
提示:建议使用谷歌浏览器浏览本网站!如单击这里下载!否则,可能无法下载附件文件!(支持大多数版本的谷歌浏览器,支持360和QQ浏览器的极速模式,即谷歌内核模式,使用IE和Edge浏览器,浏览个别网页以及下载文件时,会误报“***不安全”,此时需要单击“继续访问此不安全站点(不推荐)”才可以继续下载,另外,本网站不含任何不安全的文件,已联系微软公司解决,纯属IE和Edge浏览器误报)
回复 支持 反对

使用道具 举报

1

主题

47

帖子

7

金币

天使

Rank: 2Rank: 2

积分
67
QQ
22#
发表于 2018-7-2 18:10:51 | 只看该作者
用录制巨集的好像只会钻一个孔,之后还要想办法进草图编辑多个孔
定位销的孔是指一般的钻孔吗,目前我只研究到攻牙孔部份....
SolidWorks机械工程师网
提示:建议使用谷歌浏览器浏览本网站!如单击这里下载!否则,可能无法下载附件文件!(支持大多数版本的谷歌浏览器,支持360和QQ浏览器的极速模式,即谷歌内核模式,使用IE和Edge浏览器,浏览个别网页以及下载文件时,会误报“***不安全”,此时需要单击“继续访问此不安全站点(不推荐)”才可以继续下载,另外,本网站不含任何不安全的文件,已联系微软公司解决,纯属IE和Edge浏览器误报)
回复 支持 反对

使用道具 举报

5

主题

44

帖子

35

金币

天使

Rank: 2Rank: 2

积分
117
QQ
23#
发表于 2018-7-12 04:27:07 | 只看该作者

   经典图书
我刚开始学习API
想说用一般建模的过程把所有会用到的指令全部都练习一遍
开启SolidWorks -> 建立新零件 -> 建立草图 -> 建立特徵
目前在异形孔精灵卡关了,所以暂时没什进展
这个手动设计的流程如果可以全部用用程式码表现
那我之后想做什么样的变化应该都不会是太大的问题
但前提是测试过所有指令且全部了解
有些单一指令带了一堆参数,要搞懂真的要花不少时间
而且最干的是自己录制的巨集还不能执行,官方又没适合的范例,真的会试到上火啊

至于你说的问题,因为这支程式是自动建立零件,所以好像只能这样写
如果是写一些小工具,应该会不会把条件写死了
SolidWorks机械工程师网
回复 支持 反对

使用道具 举报

0

主题

36

帖子

7

金币

混混

Rank: 1

积分
20
QQ
24#
发表于 2018-7-16 09:47:53 | 只看该作者
异形孔我也卡蛮久的,
我现在才看到你建模的影片。
感觉蛮不错。
最后我才发现我无法帮你测定位销的孔,因为这功能是2013版后的功能,我是2012版的所以关于录制定位销的巨集无法执行的问题,目前我无解.
SolidWorks机械工程师网
回复 支持 反对

使用道具 举报

1

主题

35

帖子

14

金币

混混

Rank: 1

积分
39
QQ
25#
发表于 2018-7-22 07:42:43 | 只看该作者

   经典案例图书
直接併入SolidWorks工具列的话要用SDK这个我刚开始摸索,也不是很了解
YouTube有用C#写的教学影片,不过是英文的

这影集的最后一节是在讲有关SDK插件的写法,但我还没有很仔细研究

我最近也有在试着用VSTO写Excel插件,不过还没什么进展
看起来这与SolidWorks SDK很像,只是要写成SoliWorks插件要用他们的模板才能发佈他们的DLL
SolidWorks机械工程师网
回复 支持 反对

使用道具 举报

1

主题

39

帖子

9

金币

混混

Rank: 1

积分
21
QQ
26#
发表于 2018-7-22 08:35:26 | 只看该作者
Help没提到,虽然有范例但是是沉头孔的范例,没什么帮助,我是用录制巨集的方式查看,后来上网找找不到相关的答案,
就自己想了阿,然后可能直觉到某个地方有问题就刚好解答了疑惑.

solidWroks 转 CAD 很多尺寸都是假象,后来我都还要需要进autocad 里把尺寸炸开才避免这问题,为什么会发生我说的原因呢?
是因为 "<>"←这个符号的关系....
不知道为什么 sW的"<Num>" 转到AutoCad 时就会变成了 "<>" 导致 8 x M5 变成了 5 x M5
SolidWorks机械工程师网
回复 支持 反对

使用道具 举报

2

主题

34

帖子

18

金币

天使

Rank: 2Rank: 2

积分
60
QQ
27#
发表于 2018-7-26 09:32:35 | 只看该作者

   经典案例图书
这样都能联想出来,真的太神了!!!
我是看到一个特徵要唿叫这么多参数就很头痛,虽然有用Help的说明去试试看,但目前还是弄不出我想要的孔.....
SolidWorks机械工程师网
回复 支持 反对

使用道具 举报

3

主题

42

帖子

23

金币

天使

Rank: 2Rank: 2

积分
92
QQ
28#
发表于 2018-8-1 12:08:37 | 只看该作者
可能是特徵功能在画图上方便很多,所以写的东西与条件就多!所以在画图时没感觉,但写程式时就会感觉一堆东西,
一步一步来吧!我也是最近才慢慢研究零件建模方面的API。
SolidWorks机械工程师网
回复 支持 反对

使用道具 举报

8

主题

50

帖子

48

金币

天使

Rank: 2Rank: 2

积分
153
QQ
29#
发表于 2018-8-4 21:34:19 | 只看该作者
我已经成功用VB.NET钻出销孔了
过几天把程式码整理一下加点註解放上来
用你提出的观点去试就有结论了,感谢你给的方向
不然20几个参数排列组合的尝试真的会试到崩溃
SolidWorks机械工程师网
回复 支持 反对

使用道具 举报

2

主题

51

帖子

14

金币

天使

Rank: 2Rank: 2

积分
71
QQ
30#
发表于 2018-8-5 05:24:26 | 只看该作者

   经典图书
嗯~有时候写程式,就是通了一个观念后,很多事情就能迎刃而解了。
你真热心 提供写的程式 ,话说你进步的飞快 短短几天就搞懂了 api那么多东西.
SolidWorks机械工程师网
回复 支持 反对

使用道具 举报

6

主题

53

帖子

41

金币

天使

Rank: 2Rank: 2

积分
139
QQ
31#
发表于 2018-8-5 23:07:41 | 只看该作者
关于异形孔如果是普通直孔的话,你可以录制另一种的方式(如图),不会用到"?" 这字元,其实这个自订模式也能自订一些柱孔与沉头孔,
有机会多试试!
SolidWorks机械工程师网
回复 支持 反对

使用道具 举报

0

主题

38

帖子

2

金币

混混

Rank: 1

积分
8
QQ
32#
发表于 2018-8-6 00:48:44 | 只看该作者
可以分享吗?
SolidWorks机械工程师网
回复 支持 反对

使用道具 举报

3

主题

46

帖子

24

金币

天使

Rank: 2Rank: 2

积分
65
QQ
33#
发表于 2018-8-9 06:25:58 | 只看该作者
之后我另外发篇和建立特徵有关的帖子一起放上去
SolidWorks机械工程师网
回复 支持 反对

使用道具 举报

2

主题

40

帖子

15

金币

天使

Rank: 2Rank: 2

积分
86
QQ
34#
发表于 2018-8-13 16:32:19 | 只看该作者
用C#写真麻烦~~~
SolidWorks机械工程师网
回复 支持 反对

使用道具 举报

6

主题

34

帖子

40

金币

天使

Rank: 2Rank: 2

积分
103
QQ
35#
发表于 2018-8-15 00:32:20 | 只看该作者
加入QQ群
参与讨论和学习

SolidWorks技术交流群

或扫描二维码加入

我先把钻孔成功的范例放上来好了
SolidWorks 钻孔测试(确认可执行).zip



Imports SolidWorks.Interop.sldworks
Imports SolidWorks.Interop.swconst

Public Class Form1


  Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click


  Dim swApp As SldWorks
  Dim swModel As ModelDoc2
  Dim swFeatureMgr As FeatureManager
  Dim swFeature As Feature
  Dim swModelDocExt As ModelDocExtension
  Dim fileName As String
  Dim errors As Long
  Dim warnings As Long
  Dim status As Boolean
  Dim SlotType As Long
  Dim HoleType As Long
  Dim StandardIndex As Long
  Dim FastenerTypeIndex As Long
  Dim SSize As String
  Dim EndType As Long
  Dim ConvFactorLength As Double
  Dim ConvFactorAngle As Double
  Dim Diameter As Double
  Dim Depth As Double
  Dim Length As Double
  Dim ScrewFit As Double
  Dim DrillAngle As Double
  Dim NearCsinkDiameter As Double
  Dim NearCsinkAngle As Double
  Dim FarCsinkDiameter As Double
  Dim FarCsinkAngle As Double
  Dim Offset As Double
  Dim ThreadClass As String
  Dim CounterBoreDiameter As Double
  Dim CounterBoreDepth As Double
  Dim HeadClearance As Double
  Dim BotCsinkDiameter As Double
  Dim BotCsinkAngle As Double
  Dim swWizardHoleFeatData As WizardHoleFeatureData2



  swApp = New SldWorks
  swApp.Visible = True
  fileName = "C:\Program Files\SolidWorks Corp\SolidWorks\samples\tutorial\api\block20.sldprt"
  swModel = swApp.OpenDoc6(fileName, swDocumentTypes_e.swDocPART, swOpenDocOptions_e.swOpenDocOptions_Silent, "", errors, warnings)
  swFeatureMgr = swModel.FeatureManager
  swModelDocExt = swModel.Extension
  'Use IFeatureManager::HoleWizard5
  'to create a slot
  'Select the face where to create the slot
  status = swModelDocExt.SelectByID2("", "FACE", -0.000609805077203873, 0.0396239999998897, -0.00830387834611201, False, 0, Nothing, 0)
  SlotType = swWzdGeneralHoleTypes_e.swWzdHoleSlot
  StandardIndex = swWzdHoleStandards_e.swStandardAnsiInch
  FastenerTypeIndex = swWzdHoleStandardFastenerTypes_e.swStandardAnsiInchAllDrillSizes
  SSize = "#97"
  EndType = swEndConditions_e.swEndCondBlind
  ConvFactorLength = 25.4 / 1000 'Convert inches to meters
  ConvFactorAngle = (22 / 7) / 180 'Convert degrees to radians
  Diameter = 0.5 * ConvFactorLength
  Depth = 2 * ConvFactorLength
  Length = 3 * ConvFactorLength
  'Value1 to Value7 arguments; SolidWorks
  'ignores parameters set to -1
  ScrewFit = -1       'Value1
  DrillAngle = 100 * ConvFactorAngle'Value2
  NearCsinkDiameter = -1    'Value3
  NearCsinkAngle = -1     'Value4
  FarCsinkDiameter = -1     'Value5
  FarCsinkAngle = -1      'Value6
  Offset = -1         'Value7
  ThreadClass = ""
  swFeature = swFeatureMgr.HoleWizard5(SlotType, StandardIndex, FastenerTypeIndex,
   SSize, EndType, Diameter, Depth, Length, ScrewFit, DrillAngle,
   NearCsinkDiameter, NearCsinkAngle, FarCsinkDiameter, FarCsinkAngle, Offset, -1, -1, -1,
   -1, -1, ThreadClass, False, False, False, False, False, False)

  '_______________________________________________________________________________
  status = swModelDocExt.SelectByID2("", "FACE", -0.00134479865672033, 0.0396240000000034, -0.0399210049380327, False, 0, Nothing, 0)

  SlotType = swWzdGeneralHoleTypes_e.swWzdHoleSlot
  StandardIndex = swWzdHoleStandards_e.swStandardAnsiInch
  FastenerTypeIndex = swWzdHoleStandardFastenerTypes_e.swStandardAnsiInchAllDrillSizes
  SSize = "#1"
  EndType = swEndConditions_e.swEndCondBlind
  ConvFactorLength = 25.4 / 1000 'Convert inches to meters
  ConvFactorAngle = (22 / 7) / 180 'Convert degrees to radians
  Diameter = 0.5 * ConvFactorLength
  Depth = 2 * ConvFactorLength
  Length = 3 * ConvFactorLength
  'Value1 to Value7 arguments; SolidWorks
  'ignores parameters set to -1
  ScrewFit = -1       'Value1
  DrillAngle = 100 * ConvFactorAngle'Value2
  NearCsinkDiameter = -1    'Value3
  NearCsinkAngle = -1     'Value4
  FarCsinkDiameter = -1     'Value5
  FarCsinkAngle = -1      'Value6
  Offset = -1         'Value7
  ThreadClass = ""
  swFeature = swFeatureMgr.HoleWizard5(SlotType, StandardIndex, FastenerTypeIndex,
   SSize, EndType, Diameter, Depth, Length, ScrewFit, DrillAngle,
   NearCsinkDiameter, NearCsinkAngle, FarCsinkDiameter, FarCsinkAngle, Offset, -1, -1, -1,
   -1, -1, ThreadClass, False, False, False, False, False, False)

  '_______________________________________________________________________________

  'Print length of slot to Immediate window
  swWizardHoleFeatData = swFeature.GetDefinition
  Debug.Print("Length of slot: " & swWizardHoleFeatData.Length & " inches")
  'Use IFeatureManager::HoleWizard5
  'to create a counterbore hole
  'Select the face where to create the hole
  status = swModelDocExt.SelectByID2("", "FACE", -0.0060197480091233, 0.0396239999998329, 0.0270812377555103, False, 0, Nothing, 0)
  HoleType = swWzdGeneralHoleTypes_e.swWzdCounterBore
  StandardIndex = swWzdHoleStandards_e.swStandardAnsiInch
  FastenerTypeIndex = swWzdHoleStandardFastenerTypes_e.swStandardAnsiInchBinding
  SSize = "#12"
  EndType = swEndConditions_e.swEndCondThroughAll
  ConvFactorLength = 25.4 / 1000  'Convert inches to meters
  ConvFactorAngle = (22 / 7) / 180  'Convert degrees to radians
  Diameter = 0.5 * ConvFactorLength
  Depth = -1
  Length = -1
  'Value1 to Value12 arguments; SolidWorks
  'ignores parameters set to -1
  CounterBoreDiameter = 0.6 * ConvFactorLength  'Value1
  CounterBoreDepth = 0.2 * ConvFactorLength   'Value2
  HeadClearance = -1          'Value3
  ScrewFit = -1           'Value4
  DrillAngle = -1           'Value5
  NearCsinkDiameter = -1        'Value6
  NearCsinkAngle = -1         'Value7
  BotCsinkDiameter = -1         'Value8
  BotCsinkAngle = -1          'Value9
  FarCsinkDiameter = -1         'Value10
  FarCsinkAngle = -1          'Value11
  Offset = -1             'Value12
  ThreadClass = ""
  swFeature = swFeatureMgr.HoleWizard5(HoleType, StandardIndex, FastenerTypeIndex, SSize, EndType,
    Diameter, Depth, Length, CounterBoreDiameter, CounterBoreDepth, HeadClearance, ScrewFit, DrillAngle,
    NearCsinkDiameter, NearCsinkAngle, BotCsinkDiameter, BotCsinkAngle, FarCsinkDiameter, FarCsinkAngle,
    Offset, ThreadClass, False, False, False, False, False, False)

  End Sub

  Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
  Dim swApp As SldWorks
  Dim Part As ModelDoc2
  Dim swFeatureMgr As FeatureManager
  Dim swFeature As Feature
  Dim swModelDocExt As ModelDocExtension
  Dim swWizardHoleFeatData As WizardHoleFeatureData2

  swApp = New SldWorks
  swApp.Visible = True
  'fileName = "C:\Program Files\SolidWorks Corp\SolidWorks\samples\tutorial\api\block20.sldprt"
  'swModel = swApp.OpenDoc6(fileName, swDocumentTypes_e.swDocPART, swOpenDocOptions_e.swOpenDocOptions_Silent, "", errors, warnings)
  Part = swApp.NewPart
  swFeatureMgr = Part.FeatureManager
  swModelDocExt = Part.Extension

  '-----------------------------
  Part.Extension.SelectByID2("前基准面", "PLANE", 0, 0, 0, False, 0, Nothing, 0)
  Part.SketchManager.InsertSketch(True)
  Part.ClearSelection2(True)
  Part.SketchManager.CreateCenterRectangle(-0, 0, 0, 0.1, 0.1, 0)
  Part.SetPickMode
  Part.ClearSelection2(True)
  Part.SketchManager.InsertSketch(True)
  Part.ShowNamedView2("*不等角视图", 8)
  Part.ClearSelection2(True)
  Part.Extension.SelectByID2("草图1", "SKETCH", 0, 0, 0, False, 4, Nothing, 0)

  Part.FeatureManager.FeatureExtrusion2(True, False, True, 0, 0, 0.01, 0.01, False, False, False, False, 0.0174532925199433, 0.0174532925199433, False, False, False, False, True, True, True, 0, 0, False)
  Part.SelectionManager.EnableContourSelection = False
  Part.ClearSelection2(True)
  '-----------------------------


  'ByVal GenericHoleType As System.Integer    钻孔类型列举
  '柱孔  swWzdGeneralHoleTypes_e.swWzdCounterBore
  '锥孔  swWzdGeneralHoleTypes_e.swWzdCounterSink  
  '钻孔  swWzdGeneralHoleTypes_e.swWzdHole
  '直螺丝孔  swWzdGeneralHoleTypes_e.swWzdTap
  '斜螺丝孔  swWzdGeneralHoleTypes_e.swWzdPipeTap
  '旧制孔  swWzdGeneralHoleTypes_e.swWzdLegacy
  '柱孔狭槽  swWzdGeneralHoleTypes_e.swWzdCounterBoreSlot
  '锥孔狭槽  swWzdGeneralHoleTypes_e.swWzdCounterSinkSlot
  '狭槽  swWzdGeneralHoleTypes_e.swWzdHoleSlot

  'ByVal StandardIndex As System.Integer      尺寸单位定义
  'ISO(公制) swWzdHoleStandards_e.swStandardISO

  'ByVal FastenerTypeIndex As System.Integer    孔类型与单位配对(需与钻孔类型配对)
  '公制沉头孔swWzdHoleStandardFastenerTypes_e.swStandardISOSocketHeadCap

  'ByVal SSize As System.String         特徵树显示的孔类型
  'Ex:SSize = "M4" -> M4 六角承窝头盖螺钉的柱孔

  'ByVal EndType As System.Short        特徵终止型态定义
  '指定深度 swEndConditions_e.swEndCondBlind

  'ByVal Diameter As System.Double        钻孔直径
  'ByVal Depth As System.Double         钻孔深度
  'ByVal Length As System.Double        长度(仅对狭槽类型孔有效)

  'ByVal Value1 As System.Double        Value值依据孔类型有所不同(-1代表忽略该项目)
  'ByVal Value2 As System.Double        
  'ByVal Value3 As System.Double        
  'ByVal Value4 As System.Double        
  'ByVal Value5 As System.Double        
  'ByVal Value6 As System.Double        
  'ByVal Value7 As System.Double        
  'ByVal Value8 As System.Double        
  'ByVal Value9 As System.Double        
  'ByVal Value10 As System.Double      
  'ByVal Value11 As System.Double      
  'ByVal Value12 As System.Double      

  'ByVal ThreadClass As System.String       线程数(仅适用于 ANSI Inch标准)

  'ByVal RevDir As System.Boolean       钻孔方向
  'True-> 参考面法向量
  'False -> 反向法向量

  'ByVal FeatureScope As System.Boolean     多实体成型
  'True-> 特徵建立于"所有"实体
  'False -> 特徵建立于"所选"实体

  '尚未使用下列功能
  'ByVal AutoSelect As System.Boolean      
  'ByVal AssemblyFeatureScope As System.Boolean   
  'ByVal AutoSelectComponents As System.Boolean   
  'ByVal PropagateFeatureToParts As System.Booleam  

  '钻孔参数定义
  Dim Counterbores As New Hole(swWzdGeneralHoleTypes_e.swWzdCounterBore, swWzdHoleStandards_e.swStandardISO,
           swWzdHoleStandardFastenerTypes_e.swStandardISOSocketHeadCap, "M4",
           swEndConditions_e.swEndCondThroughAll, 0.0045, -1, -1, 0.008, 0.0045,
           -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "", False, False, False, False, False, False)

  Part.Extension.SelectByID2("", "FACE", 0, 0, 0, False, 0, Nothing, 0)

  Part.FeatureManager.HoleWizard5(Counterbores.GenericHoleType, Counterbores.StandardIndex, Counterbores.FastenerTypeIndex,
           Counterbores.SSize, Counterbores.EndType, Counterbores.Diameter, Counterbores.Depth, Counterbores.Length,
           Counterbores.Value1, Counterbores.Value2, Counterbores.Value3, Counterbores.Value4, Counterbores.Value5,
           Counterbores.Value6, Counterbores.Value7, Counterbores.Value8, Counterbores.Value9, Counterbores.Value10,
           Counterbores.Value11, Counterbores.Value12, Counterbores.ThreadClass, Counterbores.RevDir, Counterbores.FeatureScope,
           Counterbores.AutoSelect, Counterbores.AssemblyFeatureScope, Counterbores.AutoSelectComponents, Counterbores.PropagateFeatureToParts)

  End Sub

  Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
  Dim swApp As SldWorks
  Dim Part As ModelDoc2
  Dim swFeatureMgr As FeatureManager
  Dim swModelDocExt As ModelDocExtension

  swApp = New SldWorks
  swApp.Visible = True
  Part = swApp.NewPart
  swFeatureMgr = Part.FeatureManager
  swModelDocExt = Part.Extension

  '-----------------------------
  Part.Extension.SelectByID2("前基准面", "PLANE", 0, 0, 0, False, 0, Nothing, 0)
  Part.SketchManager.InsertSketch(True)
  Part.ClearSelection2(True)
  Part.SketchManager.CreateCenterRectangle(-0, 0, 0, 0.1, 0.1, 0)
  Part.SetPickMode()
  Part.ClearSelection2(True)
  Part.SketchManager.InsertSketch(True)
  Part.ShowNamedView2("*不等角视图", 8)
  Part.ClearSelection2(True)
  Part.Extension.SelectByID2("草图1", "SKETCH", 0, 0, 0, False, 4, Nothing, 0)
  Part.FeatureManager.FeatureExtrusion2(True, False, True, 0, 0, 0.01, 0.01, False, False, False, False, 0.0174532925199433, 0.0174532925199433, False, False, False, False, True, True, True, 0, 0, False)
  Part.SelectionManager.EnableContourSelection = False
  Part.ClearSelection2(True)
  '-----------------------------
  Part.Extension.SelectByID2("", "FACE", 0, 0, 0, False, 0, Nothing, 0)

  Dim PinHole As New Hole(swWzdGeneralHoleTypes_e.swWzdHole, swWzdHoleStandards_e.swStandardISO,
             swWzdHoleStandardFastenerTypes_e.swStandardISODowelHole, "?6.0",
             swEndConditions_e.swEndCondThroughAll, 0.006, 0.01, 1, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, "", False, True, True, True, True, False)

  Part.FeatureManager.HoleWizard5(PinHole.GenericHoleType, PinHole.StandardIndex, PinHole.FastenerTypeIndex,
          PinHole.SSize, PinHole.EndType, PinHole.Diameter, PinHole.Depth, PinHole.Length,
          PinHole.Value1, PinHole.Value2, PinHole.Value3, PinHole.Value4, PinHole.Value5,
          PinHole.Value6, PinHole.Value7, PinHole.Value8, PinHole.Value9, PinHole.Value10,
          PinHole.Value11, PinHole.Value12, PinHole.ThreadClass, PinHole.RevDir, PinHole.FeatureScope,
          PinHole.AutoSelect, PinHole.AssemblyFeatureScope, PinHole.AutoSelectComponents, PinHole.PropagateFeatureToParts)
  End Sub

End Class

复制代码

Public Class Hole

  Public Sub New(ByVal GenericHoleType As Integer, ByVal StandardIndex As Integer, ByVal FastenerTypeIndex As Integer, ByVal SSize As String,
       ByVal EndType As Integer, ByVal Diameter As Double, ByVal Depth As Double, ByVal Length As Double,
       ByVal Value1 As Double, ByVal Value2 As Double, ByVal Value3 As Double, ByVal Value4 As Double,
       ByVal Value5 As Double, ByVal Value6 As Double, ByVal Value7 As Double, ByVal Value8 As Double,
       ByVal Value9 As Double, ByVal Value10 As Double, ByVal Value11 As Double, ByVal Value12 As Double,
       ByVal ThreadClass As String, ByVal RevDir As Boolean, ByVal FeatureScope As Boolean, ByVal AutoSelect As Boolean,
       ByVal AssemblyFeatureScope As Boolean, ByVal AutoSelectComponents As Boolean, ByVal PropagateFeatureToParts As Boolean)
  Me.GenericHoleType = GenericHoleType
  Me.StandardIndex = StandardIndex
  Me.FastenerTypeIndex = FastenerTypeIndex
  Me.SSize = SSize
  Me.EndType = EndType
  Me.Diameter = Diameter
  Me.Depth = Depth
  Me.Length = Length
  Me.Value1 = Value1
  Me.Value2 = Value2
  Me.Value3 = Value3
  Me.Value4 = Value4
  Me.Value5 = Value5
  Me.Value6 = Value6
  Me.Value7 = Value7
  Me.Value8 = Value8
  Me.Value9 = Value9
  Me.Value10 = Value10
  Me.Value11 = Value11
  Me.Value12 = Value12
  Me.ThreadClass = ThreadClass
  Me.RevDir = RevDir
  Me.FeatureScope = FeatureScope
  Me.AutoSelect = AutoSelect
  Me.AssemblyFeatureScope = AssemblyFeatureScope
  Me.AutoSelectComponents = AutoSelectComponents
  Me.PropagateFeatureToParts = PropagateFeatureToParts
  End Sub

  Public GenericHoleType As Integer
  '柱孔  swWzdGeneralHoleTypes_e.swWzdCounterBore
  '锥孔  swWzdGeneralHoleTypes_e.swWzdCounterSink  
  '钻孔  swWzdGeneralHoleTypes_e.swWzdHole
  '直螺丝孔  swWzdGeneralHoleTypes_e.swWzdTap
  '斜螺丝孔  swWzdGeneralHoleTypes_e.swWzdPipeTap
  '旧制孔  swWzdGeneralHoleTypes_e.swWzdLegacy
  '柱孔狭槽  swWzdGeneralHoleTypes_e.swWzdCounterBoreSlot
  '锥孔狭槽  swWzdGeneralHoleTypes_e.swWzdCounterSinkSlot
  '狭槽  swWzdGeneralHoleTypes_e.swWzdHoleSlot

  Public StandardIndex As Integer
  'ISO(公制) swWzdHoleStandards_e.swStandardISO

  Public FastenerTypeIndex As Integer
  '公制沉头孔swWzdHoleStandardFastenerTypes_e.swStandardISOSocketHeadCap
  '公制定位孔swWzdHoleStandardFastenerTypes_e.swStandardISODowelHole

  Public SSize As String
  '特徵描述

  Public EndType As Integer
  '特徵终止型态

  Public Diameter As Double
  '钻孔直径

  Public Depth As Double
  '钻孔深度

  Public Length As Double
  '狭槽长度

  Public Value1 As Double
  Public Value2 As Double
  Public Value3 As Double
  Public Value4 As Double
  Public Value5 As Double
  Public Value6 As Double
  Public Value7 As Double
  Public Value8 As Double
  Public Value9 As Double
  Public Value10 As Double
  Public Value11 As Double
  Public Value12 As Double
  Public ThreadClass As String
  Public RevDir As Boolean
  Public FeatureScope As Boolean
  Public AutoSelect As Boolean
  Public AssemblyFeatureScope As Boolean
  Public AutoSelectComponents As Boolean
  Public PropagateFeatureToParts As Boolean

End Class

SolidWorks 鑽孔測試(確認可執行).zip (652.54 KB, 下载次数: 208)
SolidWorks机械工程师网
回复 支持 反对

使用道具 举报

2

主题

38

帖子

18

金币

天使

Rank: 2Rank: 2

积分
65
QQ
36#
发表于 2018-8-16 11:19:18 | 只看该作者

   经典案例图书
刚刚测试出来了,成功把用VB.NET写的视窗程式,在C#里唿叫出来 成功执行了^^
SolidWorks机械工程师网
回复 支持 反对

使用道具 举报

0

主题

44

帖子

72

金币

侠客

Rank: 3Rank: 3Rank: 3

积分
250

最佳新人活跃会员宣传达人

37#
发表于 2021-12-24 11:28:04 | 只看该作者
加入QQ群
参与讨论和学习

SolidWorks技术交流群

或扫描二维码加入

很不错,顶一下!
SolidWorks机械工程师网
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

SOLIDWORKS 2023 机械设计从入门到精通

手机版|小黑屋| GMT+8, 2025-8-9 14:53 , Processed in 0.502352 second(s), 21 queries , Memcache On.

SolidWorks机械工程师网 ( 鲁ICP备14025122号-2 ) 鲁公网安备 37028502190335号

声明:本网言论纯属发表者个人意见,与本网立场无关。
如涉版权,可发邮件: admin@swbbsc.com

快速回复 返回顶部 返回列表