重附着引出序号

重附着引出序号

    Public Sub AutoReattachAnnotation() Dim odoc As Document Set odoc = ThisApplication.ActiveDocument If ThisApplication.Documents.Count = 0 Then MsgBox "A document must be open", vbExclamation Else If odoc.DocumentType <> kDrawingDocumentObject Then MsgBox "Must be in Drawing document", vbExclamation Else Dim oDrawDoc As DrawingDocument Set oDrawDoc = ThisApplication.ActiveDocument Dim oSelectset As SelectSet Set oSelectset = oDrawDoc.SelectSet oSelectset.Clear Dim oBalloon As Balloon Dim aantal As Integer aantal = oDrawDoc.ActiveSheet.Balloons.Count Dim oTG As TransientObjects Set oTG = ThisApplication.TransientObjects Dim oBalloonCollection As ObjectCollection Set oBalloonCollection = oTG.CreateObjectCollection Dim i As Integer For i = 1 To oDrawDoc.ActiveSheet.Balloons.Count Set oBalloon = oDrawDoc.ActiveSheet.Balloons.Item(i) Call oBalloonCollection.Add(oBalloon) Next Call oSelectset.SelectMultiple(oBalloonCollection) Call ThisApplication.CommandManager.ControlDefinitions.Item("DLxAnnoReconnectCmd").Execute oSelectset.Clear End If End If End Sub
2017-6-18 18:16:2 生活 次阅读 0条评论
自动判断信息一致性

自动判断信息一致性

      Private Sub m_AppEvents_OnActivateDocument(ByVal DocumentObject As Inventor.Document, ByVal BeforeOrAfter As Inventor.EventTimingEnum, ByVal Context As Inventor.NameValueMap, ByRef HandlingCode As Inventor.HandlingCodeEnum) Handles m_AppEvents.OnActivateDocument
            Button3.PerformClick()
            Dim odocument As Document = _invApp.ActiveDocument
            Dim oshortname As String = getshortname(odocument)
            Dim idaihao As String
            Dim imingcheng As String
            If InStr(1, oshortname, " ") > 0 Then
                Do While InStr(oshortname, "  ") '如果有连续的两个空格就替换成一个空格
                    oshortname = Replace(oshortname, "  ", " ")
                Loop
                idaihao = oshortname.Split(" ")(0)
                imingcheng = oshortname.Split(" ")(1)
            Else
                imingcheng = oshortname
                idaihao = ""
            End If
            Dim iprodaihao As String = getipro(odocument, "代号", "Inventor User Defined Properties")
            If iprodaihao = idaihao Then
                TextBox1.ForeColor = System.Drawing.Color.Green
            Else
                TextBox1.ForeColor = System.Drawing.Color.Red
            End If

2017-6-11 16:44:42 生活 次阅读 0条评论
将某文件夹下所有装配体文件bom表导出

将某文件夹下所有装配体文件bom表导出

    Imports System.Windows.Forms
    Imports System.IO
    
    Public Sub Main
        Dim oPath As String
        
        ' Search for the folder
        Dim Dialog = New FolderBrowserDialog()
        Dialog.ShowNewFolderButton = True
        Dialog.Description = "Jef_E Bom's export tool"
    
        ' Show dialog box
        If DialogResult.OK = Dialog.ShowDialog() Then
            ' User clicked 'ok' on dialog box - capture the export path
            oPath = Dialog.SelectedPath & "\"
        
        Else
            ' User clicked 'cancel' on dialog box - exit
            Return
        End If
    
        ' Make a reference to a directory.
        Dim oDirectoryInfo As New DirectoryInfo(oPath)
        
        ' Get a reference to each file in that directory.
        Dim oFileArray As FileInfo() = oDirectoryInfo.GetFiles()
        
        ' Display the names of the files.
        Dim oFileInfo As FileInfo
        
        ' Loop through all files in the directory (not in the sub directories.)
        For Each oFileInfo In oFileArray
            If oFileInfo.Name.contains(".iam") Then
            
                ' Open the file
                ThisApplication.Documents.Open(oFileInfo.FullName, True) 
                
                ' Export the BOM
                
                ' Set a reference to the assembly document.
                ' This assumes an assembly document is active.
                Dim oDoc As AssemblyDocument
                oDoc = ThisApplication.ActiveDocument
                
                ' Set a reference to the BOM
                Dim oBOM As BOM
                oBOM = oDoc.ComponentDefinition.BOM
                
                ' Set the structured view to 'all levels'
                oBOM.StructuredViewFirstLevelOnly = False
            
                ' Make sure that the structured view is enabled.
                oBOM.StructuredViewEnabled = True
            
                ' Set a reference to the "Structured" BOMView
                Dim oStructuredBOMView As BOMView
                oStructuredBOMView = oBOM.BOMViews.Item("Structured")
                
                Dim oExcelPath As String
                oExcelPath = oPath & System.IO.Path.GetFileNameWithoutExtension(oDoc.FullFileName)& ".xls"
                
                ' Export the BOM view to an Excel file
                oStructuredBOMView.Export(oExcelPath, kMicrosoftExcelFormat)
                
                ' Close the document
                oDoc.Close
            
            End If
        Next
    End Sub
2017-5-29 22:5:29 科技 次阅读 0条评论
Inventor判断指定工程图标题栏是否存在

Inventor判断指定工程图标题栏是否存在

    一般,titleblockdefiition都会有一个name(名称),用这个名称去确认某个工程图中的标题栏是否是指定的。这里采用一个函数去判断,会比较简单,如下:

    Function TBExists(oTBName) As Boolean

    Exists = False

    dim oTB as TitleBlockDefinitions

    For Each oTB in oDrawDoc.TitleBlockDefinitions

2017-5-9 8:28:27 科技 次阅读 0条评论
Inventor API调用缩略图Thumbnail

Inventor API调用缩略图Thumbnail

     方法一:iproperty中获取

    Dim invPartDoc As Document = _invApp.ActiveDocument
            Dim ifilename As String = invPartDoc.FullDocumentName
            Dim apprentice As New ApprenticeServerComponent
             Dim doc As ApprenticeServerDocument
            doc = apprentice.Open(ifilename)
            Dim summaryInfo As PropertySet
            summaryInfo = doc.PropertySets.Item(
            Dim thumbProp As Inventor.Property
            thumbProp = summaryInfo.Item("Thumbnail")
            Dim thumbnail As stdole.IPictureDisp
            thumbnail = thumbProp.Value
            Dim img As Image = VB6.IPictureDispToImage(thumbnail)
            PictureBox1.Image = img

2017-5-1 7:31:42 科技 次阅读 0条评论
事件案例1

事件案例1

    Public Class clsSelect
        ' Declare the event objects
        Private WithEvents oInteraction As InteractionEvents
        Private WithEvents oSelect As SelectEvents

        ' Declare a flag that's used to determine when selection stops.
        Private bStillSelecting As Boolean

2017-4-23 21:2:16 生活 次阅读 0条评论
AutoDesk Inventor插件定制开发

AutoDesk Inventor插件定制开发

    距离初始版本有一段时间了。新版本选择更加小巧的主界面。

    本插件的开发,主要是解决国内用户的一些习惯。如工程图明细栏标准化。装配体内重命名等。主要包含以下几个功能:

    1、通过文件名提取相关数据到IPROPERTY 中,最终映射到工程图;可有效整合Inventor各种名(文件名、代号、名称等等);批量提取。

2017-4-22 15:5:44 科技 次阅读 0条评论
WORD2016加密文档测试

WORD2016加密文档测试

    无聊测试一下。可惜不能添加tag。不然还是不错的。

     

2017-4-19 14:7:40 生活 次阅读 1条评论
Inventor工程图增强打印ilogic代码

Inventor工程图增强打印ilogic代码

    将以下代码存为txt文件,通过ilogic导入外部规则,然后运行规则。主要可以自动识别纸张,并且可实现自动最佳打印模式。不必每次都去人工选择横向及纵向。实现无脑打印。

2017-4-17 13:0:57 科技 次阅读 0条评论
Inventor Bom集中导出

Inventor Bom集中导出

    Public Sub Main
        Dim oPath As String
            ' Search for the folder
        Dim Dialog = New FolderBrowserDialog()
        Dialog.ShowNewFolderButton = True
        Dialog.Description = "Jef_E Bom's export tool"
    
2017-4-16 21:15:24 科技 次阅读 0条评论
图标汇集
  • 订阅本站的 RSS 2.0 新闻聚合
  • 酷居科技
网站分类
最新留言
友情链接
控制面板
您好,欢迎到访网站!
  [查看权限]