It is currently Tue, 07 Sep 2010 17:06:35 +0000

All times are UTC - 5 hours


And enter to win a 3DConnexion Space Naviagtor 3D Mouse




Post new topic Reply to topic  [ 83 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next
Author Message
 Post subject: Re: ADD-IN: Associated DXF for Inventor 2008
PostPosted: Thu, 29 Apr 2010 16:49:39 +0000 
Offline
MCAD Lurker
User avatar

Joined: 29 Apr 2010
Posts: 9
Country: Australia
State: Non US/CAN Resident
CAD System: Inventor
I'd be prepared to pay someone to re-code this add-in to suit Inventor 2010 64 bit as about 2/3rds of our Inventor files are sheet metal that must go to a laser cutter. Using the standard dxf export tool works but is time consuming and must be done manually. This add-in sounds perfect, its just that it only seems to work on 32 bit systems. Any takers?

_________________
Brendan Henderson
Drafting Manager/Product Development Manager
____________________________________
From: B. Keogh & Sons Manufacturing Pty Ltd
Phone: +61 3 5446 8377
Facsimile: +61 3 5446 1178
Web: http://www.augers.com.au


Top
 Profile  
 
 Post subject: Re: ADD-IN: Associated DXF for Inventor 2008
PostPosted: Fri, 30 Apr 2010 14:52:58 +0000 
Offline
MCAD Addict

Joined: 02 Mar 2005
Posts: 682
Loads of our stuff goes to a laser cutter and I wrote my own add-in to create an associative DXF every time a charged part was changed. However it was never implemented as Production wanted too many bells and whistles incorporated into the DXF and wouldn't work reliably now due to a change that has crept into IV in recent versions

I'm currently working on a new more productive workflow based around running a macro from a drawing of the flat pattern (see my frustrations in viewtopic.php?f=5&t=11077 )

It all depends on what you want on the DXF.


Top
 Profile  
 
 Post subject: Re: ADD-IN: Associated DXF for Inventor 2008
PostPosted: Sun, 02 May 2010 16:25:00 +0000 
Offline
MCAD Lurker
User avatar

Joined: 29 Apr 2010
Posts: 9
Country: Australia
State: Non US/CAN Resident
CAD System: Inventor
Thanks for the contact PeterCharles. As I mentioned all we need is to export the visible outside & inside lines (IV_OUTER_PROFILE and IV_INTERIOR PROFILE). The existing method of 1) Create flat pattern, 2) Right click on FLAT PATTERN in browser tree and select SAVE COPY AS, 3)Select SAVE AS TYPE to dxf (we use the ACAD 2004 version but it could be any version), 4)Select REPLACE SPLINES with a 0.1 mm linear tolerance, 5) Save the dxf file using the exisitng Inventor part name works well but is time consuming and very repetitive.

If this could be run with a 1 button click that would be excellent! We dump all dxf files into 1 directory so probably a configurable SAVE TO path entry would be nice.

_________________
Brendan Henderson
Drafting Manager/Product Development Manager
____________________________________
From: B. Keogh & Sons Manufacturing Pty Ltd
Phone: +61 3 5446 8377
Facsimile: +61 3 5446 1178
Web: http://www.augers.com.au


Top
 Profile  
 
 Post subject: Re: ADD-IN: Associated DXF for Inventor 2008
PostPosted: Sun, 02 May 2010 17:33:15 +0000 
Offline
MCAD Addict

Joined: 02 Mar 2005
Posts: 682
If you're just cutting the inside and outside profiles, this is pretty straightforward to automate.
Do you include the flat pattern in your drawing, some do, we don't.

Give me a couple of days and I'll cobble a short macro together and e-mail you something to try.


Top
 Profile  
 
 Post subject: Re: ADD-IN: Associated DXF for Inventor 2008
PostPosted: Sun, 02 May 2010 17:52:58 +0000 
Offline
MCAD Lurker
User avatar

Joined: 29 Apr 2010
Posts: 9
Country: Australia
State: Non US/CAN Resident
CAD System: Inventor
PeterCharles, we produce the IDW of the item and if the sheet metal part is bent/rolled/folded then we add the plate pattern view to the IDW so the plasma/laser operator knows the X & Y extents of the item for plate selection and so on. I look forward to seeing your efforts. Just to reiterate that this needs to work for IV 2010 64 bit!

_________________
Brendan Henderson
Drafting Manager/Product Development Manager
____________________________________
From: B. Keogh & Sons Manufacturing Pty Ltd
Phone: +61 3 5446 8377
Facsimile: +61 3 5446 1178
Web: http://www.augers.com.au


Top
 Profile  
 
 Post subject: Re: ADD-IN: Associated DXF for Inventor 2008
PostPosted: Mon, 03 May 2010 01:15:53 +0000 
Offline
MCAD Contributer

Joined: 13 Apr 2005
Posts: 58
Hi all

I've made a small macro that export Inner and Outer contour. I have attached it. Anybody who wants is welcome to test and use it.

VBA CODE
Code:
Option Explicit
Public Sub WriteSheetMetalDXF()

    Dim iv As iv
    Set iv = New iv
   
    iv.ActiveEditObject
       
    If Not iv.GetCustom("NOTES/DXF") = True Then
        MsgBox ("Part was not exportet")
        Exit Sub
    End If
   
    ' Get the active document. This assumes it is a part document.
    Dim odoc As Document
    Set odoc = ThisApplication.ActiveEditObject

    ' Get the DataIO object.
    Dim oDataIO As DataIO
    Set oDataIO = odoc.ComponentDefinition.DataIO

    Dim sOut As String

    sOut = "FLAT PATTERN DXF?AcadVersion=2000&OuterProfileLayer=0&InteriorProfilesLayer=0" _
        + "&FeatureProfileLayer=1" _
        + "&SimplifySplines=True&MergeProfilesIntoPolyline=True" _
        + "&InvisibleLayers=IV_TANGENT;IV_BEND;IV_BEND_DOWN;IV_TOOL_CENTER;IV_TOOL_CENTER_DOWN;IV_ARC_CENTERS"
   
    ' &SplineTolerance=0,1 // Bruges hvis der ønsken lavere opløsning
   
    Dim now As String
   
    If iv.GetCustom("NOTES/DXF/DATE") = True Then
        now = Date
        now = "(" + now + ")"
    Else
        now = ""
    End If
   
    Dim thickness As String
    thickness = RemoveTrailingZero(iv.GetParam("Thickness"))
   
    Dim dxfname As String
    dxfname = iv.iProperty("Part Number") + "_" _
    + iv.iProperty("Material") + "_" + thickness _
    + " mm - " + iv.GetCustom("NOTES/DXF/QTY") + "Stk." _
    + now + ".dxf"
   
    iv.ActiveDocument
   
    If Len(Dir(iv.FilePath + "DXF\", vbDirectory)) = 0 Then
        MkDir iv.FilePath + "DXF"
    End If
   
    Dim out As String
    out = iv.FilePath + "\DXF\" + dxfname

    'Create the DXF file.
    oDataIO.WriteDataToFile sOut, out
End Sub

Function RemoveTrailingZero(Value As String)
   
    Dim r As Integer
   
    'MsgBox (Len(Value))
   
    For r = 0 To Len(Value) + 2
        If Right(Value, 1) = "0" Or Right(Value, 1) = "," Then
            Value = Left(Value, (Len(Value) - 1))
        End If
        r = r + 1
    Next
   
    RemoveTrailingZero = Value
End Function


REQUESTED CLASS
Code:
Option Explicit
' Internal functions
    Dim invDoc As Document
   
Private Sub Class_Initialize()

End Sub
Private Sub Class_Terminate()

End Sub
' Set to ActiveEditObject
    Public Function ActiveEditObject() As String
        Set invDoc = ThisApplication.ActiveEditObject
    End Function
' Set to ActiveDocument
    Public Function ActiveDocument() As String
        Set invDoc = ThisApplication.ActiveDocument
    End Function
' Set to File
    Public Function OpenFile(FullFileName) As String
       
        'Dim invApprentice As New ApprenticeServerComponent
        'Dim invDoc As ApprenticeServerDocument
       
        'Set invDoc = invApprentice.Open(FullFileName)
        Set invDoc = ThisApplication.Documents.Open(FullFileName, True)
    End Function
    Public Function CloseActiveDocument()
        ThisApplication.ActiveDocument.Close True
    End Function
' Get FileName
    Public Function FileName()
        FileName = invDoc.DisplayName
    End Function
' Get Path
    Public Function FilePath()
        FilePath = Left(invDoc.FullDocumentName, Len(invDoc.FullDocumentName) - (Len(invDoc.DisplayName)))
       
    End Function

' Get inventor iProperty
    Public Function iProperty(Name As String, Optional NewValue As String)
   
    Dim PropSet As String
   
    Dim IDSI As String
    IDSI = "Category,Manager,Company"
   
    Dim ISI As String
    ISI = "Title,Subject,Author,Keywords,Comments,Last Saved By,Revision Number,Thumbnail"
   
    If "," + IDSI + "," Like "*," + Name + ",*" Then
        PropSet = "Inventor Document Summary Information"
    ElseIf "," + ISI + "," Like "*," + Name + ",*" Then
        PropSet = "Inventor Summary Information"
    Else
        PropSet = "Design Tracking Properties"
    End If
   
    ' Get the property set.
    Dim invInfo As PropertySet
    Set invInfo = invDoc.PropertySets.Item(PropSet)
   
    If NewValue = "" Then
        iProperty = invInfo.Item(Name).Value
    Else
        invInfo.Item(Name).Value = NewValue
    End If

End Function

'Gets parameter from part
Public Function GetParam(paramName As String, Optional UnitType As String) As String
       
      Dim params As ModelParameters
      Dim partDoc As PartDocument
      Dim assyDoc As AssemblyDocument
      Dim newExpression As String
      Dim uom As UnitsOfMeasure
     
      If UnitType = "" Then
        UnitType = "mm" 'kDefaultDisplayLengthUnits
      End If
           
      ' cast to the appropriate document type, and get params
      ' Note: uom can actually be accessed directly from the ThisApplication object
      If TypeOf invDoc Is AssemblyDocument Then
        Set assyDoc = invDoc
        Set params = assyDoc.ComponentDefinition.parameters.ModelParameters
        Set uom = assyDoc.UnitsOfMeasure
      ElseIf TypeOf invDoc Is PartDocument Then
        Set partDoc = invDoc
        'Check for document subtype
        If partDoc.DocumentSubType.DocumentSubTypeID = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then
            'Get component's definition
            Dim oCompDef As SheetMetalComponentDefinition
            Set oCompDef = partDoc.ComponentDefinition
            Set params = oCompDef.parameters.ModelParameters
            Set uom = partDoc.UnitsOfMeasure
        Else
            Set params = partDoc.ComponentDefinition.parameters.ModelParameters
            Set uom = partDoc.UnitsOfMeasure
        End If
      End If
   
      If Not (params Is Nothing) Then
        ' try to get the parameter passed to the function
       
        On Error Resume Next
            Dim Param As ModelParameter
            Set Param = params.Item(paramName)

        If Err.Number <> 0 Then
            newExpression = ""
        Else
            If Not (Param Is Nothing) Then
                ' convert to an expression in current document units
                ' this assumes the parameter is a length parameter (no check is made)
                newExpression = uom.GetStringFromValue(Param.Value, UnitType)
               
                newExpression = Left(newExpression, (Len(newExpression) - Len(UnitType) - 1))
            End If
        End If
       
            ' assign value for return
            GetParam = newExpression
           
      End If
End Function

' Manage Custom properties
    Public Function SetCustom(MyPropName As String, Optional MyValue As String, Optional confirm As Boolean) As String
       
        ' Get the custom property set.
            Dim invCustomPropertySet As PropertySet
            Set invCustomPropertySet = _
            invDoc.PropertySets.Item("Inventor User Defined Properties")
               
        ' Attempt to get an existing custom property named "Volume".
            On Error Resume Next
            Dim invVolumeProperty As Property
            Set invVolumeProperty = invCustomPropertySet.Item(MyPropName)
           
            If Err.Number <> 0 Then
                ' Failed to get the property, which means it doesn't exist
                ' so we'll create it.
                    Call invCustomPropertySet.Add(MyValue, MyPropName)
            Else
                ' We got the property so update the value.
                    If confirm = True Then
                        Dim lReply As Long
                        lReply = MsgBox("Do you realy want to update value?", vbOKCancel)
                        If lReply = vbCancel Then Exit Function
                        'confirm ("Do you realy want to update value?")
                    End If
                    invVolumeProperty.Value = MyValue
            End If
    End Function
   
    Public Function SetCustomInt(MyPropName As String, Optional MyValue As Double, Optional confirm As Boolean) As String
       
        ' Get the custom property set.
            Dim invCustomPropertySet As PropertySet
            Set invCustomPropertySet = _
            invDoc.PropertySets.Item("Inventor User Defined Properties")
               
        ' Attempt to get an existing custom property named "Volume".
            On Error Resume Next
            Dim invVolumeProperty As Property
            Set invVolumeProperty = invCustomPropertySet.Item(MyPropName)
           
            If Err.Number <> 0 Then
                ' Failed to get the property, which means it doesn't exist
                ' so we'll create it.
                    Call invCustomPropertySet.Add(MyValue, MyPropName)
            Else
                ' We got the property so update the value.
                    If confirm = True Then
                        Dim lReply As Long
                        lReply = MsgBox("Do you realy want to update value?", vbOKCancel)
                        If lReply = vbCancel Then Exit Function
                        'confirm ("Do you realy want to update value?")
                    End If
                    invVolumeProperty.Value = MyValue
            End If
       
    End Function
   
    Public Function SetCustomDate(MyPropName As String, Optional MyValue As Date, Optional confirm As Boolean) As String
       
        ' Get the custom property set.
            Dim invCustomPropertySet As PropertySet
            Set invCustomPropertySet = _
            invDoc.PropertySets.Item("Inventor User Defined Properties")
               
        ' Attempt to get an existing custom property named "Volume".
            On Error Resume Next
            Dim invVolumeProperty As Property
            Set invVolumeProperty = invCustomPropertySet.Item(MyPropName)
           
            If Err.Number <> 0 Then
                ' Failed to get the property, which means it doesn't exist
                ' so we'll create it.
                    Call invCustomPropertySet.Add(MyValue, MyPropName)
            Else
                ' We got the property so update the value.
                    If confirm = True Then
                        Dim lReply As Long
                        lReply = MsgBox("Do you realy want to update value?", vbOKCancel)
                        If lReply = vbCancel Then Exit Function
                        'confirm ("Do you realy want to update value?")
                    End If
                    invVolumeProperty.Value = MyValue
            End If
   
    End Function
   
    Public Function SetCustomBool(MyPropName As String, Optional MyValue As Boolean, Optional confirm As Boolean) As String
           
        ' Get the custom property set.
            Dim invCustomPropertySet As PropertySet
            Set invCustomPropertySet = _
            invDoc.PropertySets.Item("Inventor User Defined Properties")
               
        ' Attempt to get an existing custom property named "Volume".
            On Error Resume Next
            Dim invVolumeProperty As Property
            Set invVolumeProperty = invCustomPropertySet.Item(MyPropName)
           
            If Err.Number <> 0 Then
                ' Failed to get the property, which means it doesn't exist
                ' so we'll create it.
                    Call invCustomPropertySet.Add(MyValue, MyPropName)
            Else
                ' We got the property so update the value.
                    If confirm = True Then
                        Dim lReply As Long
                        lReply = MsgBox("Do you realy want to update value?", vbOKCancel)
                        If lReply = vbCancel Then Exit Function
                        'confirm ("Do you realy want to update value?")
                    End If
                    invVolumeProperty.Value = MyValue
            End If
       
    End Function
   
    Public Function GetCustom(MyPropName As String, Optional confirm As Boolean) As String
               
        ' Get the custom property set.
            Dim invCustomPropertySet As PropertySet
            Set invCustomPropertySet = _
            invDoc.PropertySets.Item("Inventor User Defined Properties")
               
        ' Attempt to get an existing custom property named "Volume".
            On Error Resume Next
            Dim invVolumeProperty As Property
            Set invVolumeProperty = invCustomPropertySet.Item(MyPropName)
           
            If Err.Number <> 0 Then
                ' Failed to get the property, which means it doesn't exist
                ' so we'll create it.
                If confirm = True Then
                    MsgBox ("Property does not exists")
                Else
                    GetCustom = False
                End If
            Else
                ' We got the property so update the value.
                    GetCustom = invVolumeProperty.Value
            End If
    End Function



Before running macro you have to fill in some custom properties, please see attached picture.

Hoping this is any use!


Attachments:
CustomProp.JPG
CustomProp.JPG [ 34.23 KiB | Viewed 88 times ]
Top
 Profile  
 
 Post subject: Re: ADD-IN: Associated DXF for Inventor 2008
PostPosted: Mon, 03 May 2010 01:22:12 +0000 
Offline
MCAD Lurker
User avatar

Joined: 29 Apr 2010
Posts: 9
Country: Australia
State: Non US/CAN Resident
CAD System: Inventor
Thanks. Forgive my ignorance but where is the attachment and how do I download it so I can give it a whirl?

_________________
Brendan Henderson
Drafting Manager/Product Development Manager
____________________________________
From: B. Keogh & Sons Manufacturing Pty Ltd
Phone: +61 3 5446 8377
Facsimile: +61 3 5446 1178
Web: http://www.augers.com.au


Top
 Profile  
 
 Post subject: Re: ADD-IN: Associated DXF for Inventor 2008
PostPosted: Mon, 03 May 2010 02:03:27 +0000 
Offline
MCAD Contributer

Joined: 13 Apr 2005
Posts: 58
Hi brendanh

Sorry I did not attach the macro. Instead I just pasted it into the thread.

Hoping you can throw it into your own macro.


Top
 Profile  
 
 Post subject: Re: ADD-IN: Associated DXF for Inventor 2008
PostPosted: Mon, 03 May 2010 09:08:32 +0000 
Offline
MCAD Contributer

Joined: 05 Jan 2005
Posts: 105
Country: Canada
State: Manitoba
CAD System: Inventor
We would also be willing to pay for an addin that did this. Our process is almost identical to what brendanh is doing. I just know absolutely nothing about making addins or macros.


Top
 Profile  
 
 Post subject: Re: ADD-IN: Associated DXF for Inventor 2008
PostPosted: Mon, 03 May 2010 11:17:52 +0000 
Offline
MCAD Addict

Joined: 02 Mar 2005
Posts: 682
Beaten to it then :(
I'll just go into the corner and sulk.....


Top
 Profile  
 
 Post subject: Re: ADD-IN: Associated DXF for Inventor 2008
PostPosted: Mon, 03 May 2010 12:32:21 +0000 
Offline
MCAD Contributer

Joined: 13 Apr 2005
Posts: 58
I have not tried to code any add-in yet. However I have coded other programs in VS2005. If anyone who knows something about add-ins. I would like to create this add-in together. I think I have all the code in VBA for this project.


Top
 Profile  
 
 Post subject: Re: ADD-IN: Associated DXF for Inventor 2008
PostPosted: Mon, 03 May 2010 14:49:21 +0000 
Offline
MCAD Addict

Joined: 02 Mar 2005
Posts: 682
brendanh wrote:
Thanks. Forgive my ignorance but where is the attachment and how do I download it so I can give it a whirl?


Brendan, I've sent you an e-mail.


Top
 Profile  
 
 Post subject: Re: ADD-IN: Associated DXF for Inventor 2008
PostPosted: Mon, 03 May 2010 15:11:09 +0000 
Offline
MCAD Contributer
User avatar

Joined: 10 Sep 2007
Posts: 76
Country: France
State: Non US/CAN Resident
CAD System: Inventor
Quote:
If anyone who knows something about add-ins. I would like to create this add-in together. I think I have all the code in VBA for this project.


I will be happy to work with you. I also propose to translate it into french.

@Teun Ham
What do you think about this project ?

_________________
Christophe S....t


Top
 Profile  
 
 Post subject: Re: ADD-IN: Associated DXF for Inventor 2008
PostPosted: Mon, 03 May 2010 16:19:28 +0000 
Offline
MCAD Lurker
User avatar

Joined: 29 Apr 2010
Posts: 9
Country: Australia
State: Non US/CAN Resident
CAD System: Inventor
PeterCharles, don't give up. I'll have a look at the code supplied by groyk and see how it fits and let the thread know. I have not received your email, not in junk or deleted. I have checked the address in the UCP and it is correct. Please try again!

Groyk, forgive my ignorance I know nothing of VBA and macros so I'll have my IT mate look at it and will report back to the thread.

It's great to see new interest in this process. I've questioned our Inventor supplier why this type of function is not in Inventor and they say that it steps on the toes of 3rd party companies who do the part/plate nesting in conjunction with Autodesk.

_________________
Brendan Henderson
Drafting Manager/Product Development Manager
____________________________________
From: B. Keogh & Sons Manufacturing Pty Ltd
Phone: +61 3 5446 8377
Facsimile: +61 3 5446 1178
Web: http://www.augers.com.au


Top
 Profile  
 
 Post subject: Re: ADD-IN: Associated DXF for Inventor 2008
PostPosted: Mon, 03 May 2010 23:49:31 +0000 
Offline
MCAD Contributer

Joined: 13 Apr 2005
Posts: 58
Hi nomutt

Do you have any VS2005 template for add-ins. I think that is where to start as I haven't tried coding plugins yet.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 83 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group