|
图纸格式替换主要是SetupSheet系列的函数。下面罗列的是solidworks2014最新的SetupSheet5(其他低于2014版本最新的是SetupSheet4)
这个函数的IDrawingDoc的方法。可参照API帮助文件,IDrawingDoc接口下的SetupSheet5.
语法是VB语言写的,其他语言,参数也是一样的,书写格式不同罢了。
Dim instance As IDrawingDoc
Dim Name As System.String
Dim PaperSize As System.Integer
Dim TemplateIn As System.Integer
Dim Scale1 As System.Double
Dim Scale2 As System.Double
Dim FirstAngle As System.Boolean
Dim TemplateName As System.String
Dim Width As System.Double
Dim Height As System.Double
Dim PropertyViewName As System.String
Dim RemoveModifiedNotes As System.Boolean
Dim value As System.Boolean
value = instance.SetupSheet5(Name, PaperSize, TemplateIn, Scale1, Scale2, FirstAngle, TemplateName, Width, Height, PropertyViewName, RemoveModifiedNotes)
参数讲解:instance,Dim instance As IDrawingDoc,为SOLIDWORKS工程图文件。
Name,Dim Name As System.String,为SOLIDWORKS工程图文件中的工程图名称
PaperSize,Dim PaperSize As System.Integer,SOLIDWORKS工程图文件中的工程图图纸的尺寸类型,
Dim TemplateIn As System.Integer,临时模板的工程图图纸的尺寸类型。常选择swDwgTemplateCustom
Dim Scale1 As System.Double
Dim Scale2 As System.Double,这个是图纸的比例,如果Scale1=0,Scale2=0,图纸将保持原来的比例。
Dim FirstAngle As System.Boolean,工程图视角,True为第一视角。False为第三视角。
Dim TemplateName As System.String,“.slddrt”文件,需要替换的工程图纸格式模板文件。需要全名称(包含文件路径)。
Dim Width As System.Double , 假如TemplateIn被设定为 swDwgTemplateNone 或者 swDwgPapersUserDefined,Paper width
Dim Height As System.Double 假如TemplateIn被设定为 swDwgTemplateNone 或者 swDwgPapersUserDefined,Paper height
Dim PropertyViewName As System.String,包含有当前模型属性的视图名称,可以为empty,"","Default",这三个选其一。
Dim RemoveModifiedNotes As System.Boolean,是否移除注解SetupSheet4,没有这个参数
Dim value As System.Boolean,函数的返回值
写完后需要条用IModelDoc2::ForceRebuild3。
附件总有一个案例SetupSheet4。
Macro1.zip
(6.23 KB, 下载次数: 147)
|
|