iCAx开思网

标题: 关于CATIA转换IGS数据的程序。 [打印本页]

作者: kinvenyao    时间: 2012-7-4 16:10
标题: 关于CATIA转换IGS数据的程序。
有一个VB程序用作CATIA 转换 IGS的,一个CATIA Part 文件 有N个几何体,要每一个单独转换IGS出来,现在这个程序是全部几何体都转换出来,能不能改成只转换显示的几何体啊?求教。附程序:

Sub CATMain()
Dim i, n As Integer
Dim name, prt As String
Dim BodyName() As String
Dim partDocument1 As PartDocument
On Error Resume Next
Set partDocument1 = CATIA.ActiveDocument

name = partDocument1.FullName
Dim part1 As Part
Set part1 = partDocument1.Part
Dim bodies1 As Bodies
Set bodies1 = part1.Bodies
Dim body1 As Body
Dim sel As Selection
Set sel = partDocument1.Selection
Dim documents2 As Documents
Dim partDocument2 As PartDocument
Dim part2 As Part
Dim specsAndGeomWindow1 As SpecsAndGeomWindow
n = bodies1.Count
prt = Left(partDocument1.name, Len(partDocument1.name) - 8)
For i = 1 To n
    ReDim Preserve BodyName(i)
    BodyName(i) = bodies1.Item(i).name
    Set partDocument1 = CATIA.ActiveDocument
    sel.Clear
    sel.Add bodies1.Item(i)
    sel.Copy
    Set documents2 = CATIA.Documents
    Set partDocument2 = documents2.Add("Part")
    partDocument2.Product.PartNumber = BodyName(i)
    Set partDocument2 = CATIA.ActiveDocument
    Set specsAndGeomWindow1 = CATIA.ActiveWindow
    Set part2 = partDocument2.Part
    sel.Add part2
    sel.PasteSpecial ("CATPrtResultWithOutLink")
    part2.Update
    Set partDocument2 = CATIA.ActiveDocument
    partDocument2.ExportData Left(name, Len(name) - Len(partDocument1.name)) & BodyName(i) & ".igs", "igs"
    specsAndGeomWindow1.Close
    partDocument2.Close

Next i

End Sub









欢迎光临 iCAx开思网 (https://www.icax.org/) Powered by Discuz! X3.3