Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Drawing views to AutoCAD blocks, possible ?

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
M
Contributor
585 Views, 3 Replies

Drawing views to AutoCAD blocks, possible ?

Hello

 

I was wondering if there is a way through iLogic, or API to convert each view to a seperate block while exporting a inventor IDW/DWG file to Autocad file.

 

Currently I'm using a iLogic method found in Autodesk help to export IDW/DWG to Autocad DWG, I have customized some code for my needs, and I was wondering if You can just write some code so the views would become blocks. I don't care about the scale, what You see is saved as blocks, one view one block, view and cross section to 2 sepatere blocks etc...

 

Naming of the blocks could depend on file name + sheet name + View number (not view name)

 

I'd prefer it to be a iLogic solution if possible at all, API is still sorcery to me.

 

Code I'm using for exporting to AutoCAD dwg is as follows: (code supports multiseet files)

 

SyntaxEditor Code Snippet

    '------start of iLogic-------
    oPath = ThisDoc.Path
    oFileName = ThisDoc.FileName(False) 'without extension
    oRevNum = iProperties.Value("Project", "Revision Number")
    ' Get the DWG translator Add-In.
    Dim DWGAddIn As TranslatorAddIn
    DWGAddIn = ThisApplication.ApplicationAddIns.ItemById("{C24E3AC2-122E-11D5-8E91-0010B541CD80}")

    'Set a reference to the active document (the document to be published).
    Dim oDocument As Document
    oDocument = ThisApplication.ActiveDocument

    Dim oContext As TranslationContext
    oContext = ThisApplication.TransientObjects.CreateTranslationContext
    oContext.Type = kFileBrowseIOMechanism

    ' Create a NameValueMap object
    Dim oOptions As NameValueMap
    oOptions = ThisApplication.TransientObjects.CreateNameValueMap

    ' Create a DataMedium object
    Dim oDataMedium As DataMedium
    oDataMedium = ThisApplication.TransientObjects.CreateDataMedium

    ' Check whether the translator has 'SaveCopyAs' options
    If DWGAddIn.HasSaveCopyAsOptions(oDocument, oContext, oOptions) Then
    ' Path for DWG export ini file
        Dim strIniFile As String
        strIniFile = "z:\ExportToAutoCadDWG\ExportToAutoCadDWG_nofile.ini"
        ' Create the name-value that specifies the ini file to use.
        oOptions.Value("Export_Acad_IniFile") = strIniFile
    End If

    Dim oFolder = oPath & "\DWG Acad" ' Change path in quotes to suit your needs

    'Check for the file folder and create it if it does not exist
    If Not System.IO.Directory.Exists(oFolder) Then
        System.IO.Directory.CreateDirectory(oFolder)
    End If

    'Set the DWG target file name
    If oRevNum = ""
    oDataMedium.FileName = oFolder & "\" & oFileName & ".dwg" 
    Else
    'Set the DWG target file name
    'oDataMedium.FileName = oFolder & "\" & oFileName & " R" & oRevNum & ".dwg"
    oDataMedium.FileName = oFolder & "\" & oFileName & ".dwg"
    End If

    'Publish document.
    DWGAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
    '------end of iLogic------- 

 Thank You for any effort 🙂

 

M.

APDSU 2015-2021
==========================================================
Please use the "Accept as Solution" and "Give Kudos" functions as appropriate to further enhance the value of these forums.
3 REPLIES 3
Message 2 of 4
ILU
Enthusiast
in reply to: M

hi @M  

 

have you found any solution to your very old question ? 🙂

Message 3 of 4
M
Contributor
in reply to: ILU

Sorry for the late reply.

 

No I havent found any solution for that issue.

APDSU 2015-2021
==========================================================
Please use the "Accept as Solution" and "Give Kudos" functions as appropriate to further enhance the value of these forums.
Message 4 of 4
bradeneuropeArthur
in reply to: M

Hi @M 

All Views are already available as Autocad block there is no coding needed.

In the drawing Browser you find the Autocad Blocks Folder.

bradeneuropeArthur_0-1615889146451.png

 

Regards,

Regards,

Arthur Knoors

Autodesk Affiliations:

Autodesk Software:Inventor Professional 2024 | Vault Professional 2022 | Autocad Mechanical 2022
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!


! For administrative reasons, please mark a "Solution as solved" when the issue is solved !

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report