Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How do I export each item in an assembly as an iges?

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
jpblower
419 Views, 5 Replies

How do I export each item in an assembly as an iges?

I'm new to IV VBA and so far I'm finding the help to be no help at all.  I need to take an assembly and export each part in that assy as an iges.  The examples I've seen are way over my head and when I try to break down each element w/ the help or internet I get squat.  ie. TranslatorAddin, no answers in the help files and internet searches bring up all sorts of code.  One item is .SaveCopyAs(...,...,...,...).  I can't seem to even find a help command that lays out what is needed to use this.  Only through searching in other's code can I find the variable types needed but then I hit a wall trying to understand the variable types. 

 

Can someone help me get started? 

Is the help for IV somewhere in a .pdf so I can do better searches? 

5 REPLIES 5
Message 2 of 6
jpblower
in reply to: jpblower

To further clarify, I look in the help for transientobjects.  Nothing.  I can however find something using F1 however I get this description.

 

"Gets the object through which all general transient objects are created."

 

In other words, kruxeldefific is definded as: something that is kruxeldefif like.

Message 3 of 6

Hi jpblower,

 

Here is a quick iLogic rule that will create an *.igs file for each part file it finds in the assembly. Also just as a tip, you can search and ask programming questions of this type on the Inventor Customization forum too:
http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/bd-p/120

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

'Define the open document
Dim openDoc As Document
openDoc = ThisDoc.Document

'define folder to create files in
oFolder = "C:\Temp\IGS Files"

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

'Look at all of the files referenced in the open document
Dim docFile As Document
For Each docFile In openDoc.AllReferencedDocuments                
'format  file name                   
Dim FNamePos As Long
'postion of last back slash
FNamePos = InStrRev(docFile.FullFileName, "\", -1)                        
Dim docFName As String 
'file name with extension
docFName = Right(docFile.FullFileName, Len(docFile.FullFileName) - FNamePos) 
'file name without extension
shortname = Left(docFName, Len(docFName) -4) 

	' Get the IGES translator Add-In.
	Dim oIGESTranslator As TranslatorAddIn
	oIGESTranslator = ThisApplication.ApplicationAddIns.ItemById _ 
	("{90AF7F44-0C01-11D5-8E83-0010B541CD80}")
	Dim oContext As TranslationContext
	oContext = ThisApplication.TransientObjects.CreateTranslationContext
	Dim oOptions As NameValueMap
	oOptions = ThisApplication.TransientObjects.CreateNameValueMap
	If oIGESTranslator.HasSaveCopyAsOptions(docFile, oContext, oOptions) Then
	   ' Set geometry type for wireframe.
	   ' 0 = Surfaces, 1 = Solids, 2 = Wireframe
	   'oOptions.Value("GeometryType") = 1
	   ' To set other translator values:
	   ' oOptions.Value("SolidFaceType") = n
	   ' 0 = NURBS, 1 = Analytic
	   ' oOptions.Value("SurfaceType") = n
	   ' 0 = 143(Bounded), 1 = 144(Trimmed)
	oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
	Dim oData As DataMedium
	oData = ThisApplication.TransientObjects.CreateDataMedium
	'set file path for IGS file
	oData.FileName =  oFolder & "\" & shortname & ".igs"
	oIGESTranslator.SaveCopyAs(docFile, oContext, oOptions, oData)
	End If
Next

 

Message 4 of 6

Thanks,however my issue is less the code itself rather how to identify the elements within. 

Ie.  the IGES translator ID is ("{90AF7F44-0C01-11D5-8E83-0010B541CD80}").  If not for copying from this forum or another file how on earth would I ever be able to find that number? 

 

In the nameValueMap options values for a *.pdf and I want to set the option "Sheets in Range>From" I need to write ' *.Value("Custom_Begin_Sheet").  How do I find out that "Custom_Begin_Sheet" is the value for that particular option?  If I didn't already know the value needed I can't find any way to discover that other than searching through tons of internet code praying someone used the options I need.

 

This example is the best I've been able to find but rather cumbersome just to find an option value.

http://adndevblog.typepad.com/manufacturing/2014/02/get-option-names-and-values-supported-by-invento...

 

Message 5 of 6

Hi jpblower,

 

I would start with the Programming Help pages and lookup TranslatorAddIn for example, then dig through the TranslatorAddIn Members.

 

 

 

There are some more link to look at here:

http://inventortrenches.blogspot.com/2013/10/ilogic-how-to-learn-inventors.html

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

Message 6 of 6

Thanks, i was looking in areas of help which would never point me in the right direction.  When searching under Translator Addins I gets me the information I was looking for, as opposed to looking in the values property for NameValueMap.  While this is horribly frustrating starting out it does help me see the mindset of the help.

 

 

 

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

Post to forums