inventor 3D model to 2D drawings issue

inventor 3D model to 2D drawings issue

Anonymous
Not applicable
399 Views
3 Replies
Message 1 of 4

inventor 3D model to 2D drawings issue

Anonymous
Not applicable

Hi,

 

we are facing some problem while extracting 2D drawing from the model, if we change the input detailsfor the model. The drawing extracted from the updated model does not show correct dimensions and also the sections cut from the model are missing. is there a way to use the same model to extract new drawings after changing inputs , without encountering such errors? 

0 Likes
400 Views
3 Replies
Replies (3)
Message 2 of 4

adam.nagy
Autodesk Support
Autodesk Support

Hi,

 

What exactly are you doing? Could you provide the exact steps?

Do you only run into problems when doing things through the API? - or same through the UI?

 

Cheers,   



Adam Nagy
Autodesk Platform Services
0 Likes
Message 3 of 4

Anonymous
Not applicable

@adam.nagy wrote:

Hi,

 

What exactly are you doing? Could you provide the exact steps?

Do you only run into problems when doing things through the API? - or same through the UI?

 

Cheers,   


Dear Mr Nagy

 

We are using MS Excel as an input sheet to create a model. After creating a model, we define all the sections and views required in the detail drawing. Now if we are using any existing model as a reference to create a new model, by changing the values defined in input excel sheet, the model gets updated, but while extracting 2D detail, it shows errors for the sections and details defined in original model. Also the dimensions are not updated correctly as the start and end point is taken from the original model, not from the updated model. Is there any way to delete the existing sections and detail view defined in model and insert new views and sections or updated the existing one? Also how to update the dimensions ?

0 Likes
Message 4 of 4

Owner2229
Advisor
Advisor

Hi, here is a code I used to create new drawings from existing drawings, when the drawing views and dimensions are the same in both old and new drawing. You might need to modify it, but I hope it might help you. Run it from the part/assembly you want to create the drawing for.

 

1) It will first promt you to enter the name of the original drawing

2) It will search for what you've entered in the folder where the current model is

3) Then it will promt you to find the folder, if it can't find the drawing in the folder of the model.

 

Sub Main()
    Dim oDoc As Document = ThisApplication.ActiveDocument
    Dim oDocName As String = oDoc.FullFileName
    Dim oNewName As String = ThisDoc.Path & "\" & ThisDoc.FileName(False) & ".idw"
    Dim SearchedDrawing As String
    SearchedDrawing = ThisDoc.FileName(False)
    SearchedDrawing = InputBox("Please enter the full name of the drawing that you want to derive the new one from." & vblf & vblf & "Without extension.", "Input", SearchedDrawing)
    If SearchedDrawing = vbNullString Then
        Exit Sub
    End If
    Dim oDrawing As Document
    Try
        oDrawing = ThisApplication.Documents.Open(ThisDoc.Path & "\" & SearchedDrawing & ".idw", False)
    Catch
        Dim oPath As String = ThisDoc.Path
        Dim dialog = New System.Windows.Forms.FolderBrowserDialog()
        dialog.SelectedPath = oPath
        dialog.ShowNewFolderButton = True
        If System.Windows.Forms.DialogResult.OK = dialog.ShowDialog() Then
            oPath = dialog.SelectedPath
            oDrawing = ThisApplication.Documents.Open(oPath & "\" & SearchedDrawing & ".idw", False)
        Else
            Exit Sub
        End If
    End Try
    oDrawing.Update()
    oDrawing.SaveAs(oNewName, True)
    oDrawing.Close(True)
    Dim oNewDrawing As Document = ThisApplication.Documents.Open(oNewName, True)
    Dim oRefFile As FileDescriptor
    For Each oRefFile In oNewDrawing.File.ReferencedFileDescriptors
        oRefFile.ReplaceReference(oDocName)
    Next
    oNewDrawing.Save
End Sub
Consider using "Accept as Solution" / "Kudos" if you find this helpful.
- - - - - - - - - - - - - - -
Regards,
Mike

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods
0 Likes