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: 

iparts and drawings, cannot retrieve annotations

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
gharveyMHN58
663 Views, 5 Replies

iparts and drawings, cannot retrieve annotations

Hello,

 

Is it possible to retrieve model dimensions in an inventor drawing from an iPart file. I have some fully toleranced iParts but no dimensions show in the drawing when trying to retrieve them as per a normal ipt.

 

Any help greatly appreciated.

5 REPLIES 5
Message 2 of 6
jtylerbc
in reply to: gharveyMHN58

It's been a long time since I've tried that, so I may be remembering incorrectly.  But I don't think it's possible.

 

The way the individual iPart members are created, the sketches don't actually exist in them.  So technically, there is nothing there to retrieve.

Message 3 of 6
gharveyMHN58
in reply to: jtylerbc

Thank you for your reply, if that is the case then that is very frustrating. 

 

Creating X number of files for the X number of ipart members, and reverting each one to a standard component might have to be how I achieve this then. 

 

I have in mind an ilogic/vba code that will create the X number of reverted files: 

1. save new file as ipart member name

2. open the new file and delete other ipart rows/members

3. revert to a normal part

4. back in the base model, repeat 1-3 for each member

 

This would in effect be a 'generate files' command, but each file would be a standalone model with full sketches and tolerances.

 

The only step I'm unsure of being able to do in ilogic is step 3.

 

From there one drawing can be created, copied X times and then the model reference replaced for the remaining drawings, hopefully if the parts are similar enough this will achieve most of what I hoped to achieve. 

 

 

Message 4 of 6
johnsonshiue
in reply to: gharveyMHN58

Hi! Except hole/thread notes, no dimensions can be retrieved from iPart member files. It is because the iPart member files are like derived parts of the iPart factory file.

You will need to use Model States in 2022, which allows you the retrieve model dimensions on a per model state basis.

Many thanks!



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
Message 5 of 6
gharveyMHN58
in reply to: johnsonshiue

Thank you @johnsonshiue .

 

As I understand it model states cannot be individually managed in Vault, and a separate release processes for individual model states wouldn't be possible. 

Message 6 of 6
gharveyMHN58
in reply to: gharveyMHN58

If this would be useful to anyone this ilogic will achieve a modified 'generate files' command, producing a folder containing individual models for each iPart member, all reverted to normal ipt. files.

Dim partDoc As PartDocument
partDoc = ThisApplication.ActiveDocument
Dim oCompDef As PartComponentDefinition
oCompDef = partDoc.ComponentDefinition

'get the name of the iPart parent
Dim iPartParentName As String = ThisDoc.FileName(False) 'without extension

'create a folder for the exported models, in the same location as the parent iPart
Dim oFolder As String
oFolder = ThisDoc.Path & "\" & iPartParentName & " EXPORTED MODELS"
If System.IO.Directory.Exists(oFolder) = False Then
	System.IO.Directory.CreateDirectory(oFolder)
ElseIf System.IO.Directory.Exists(oFolder) = True Then
	'option if exists
End If

'get the number of ipart members
Dim iPartRows As Integer = oCompDef.iPartFactory.TableRows.count()

'now for each iPart member we will export a new model
Dim currentrow As Integer
For currentrow = 1 To iPartRows
	
	'activate the currentrow
	iPart.ChangeRow("", currentrow)
	
	'here the part number of the current member will be used to save the new exported model
	'this could be any combination of properties you choose
	Dim partno As String = iProperties.Value("Project", "Part Number")
	
	'now we save a copy of the iPart with the new name, in the new folder
	Dim NewFileNameAndExtension As String = oFolder & "\" & partno & ".ipt"
	ThisDoc.Document.SaveAs(NewFileNameAndExtension , True)
	
	'now we open the newly created file
	ThisDoc.Launch(NewFileNameAndExtension)
	ExportedPart = ThisApplication.Documents.ItemByName(NewFileNameAndExtension)
	
	'define the ilogicAutomation
	Dim iLogicAuto As Object
	iLogicAuto = iLogicVb.Automation 
	
	'get the rule that will revert the model to a standard part, it will automatically 
	'appear in the newly created file if it is in the base iPart
	Dim oRuleName As String = "iPartExport"
	Dim oRule As Object 
	oRule = iLogicAuto.GetRule(ExportedPart, oRuleName) 
	
	'run the rule in the new file
	iLogicAuto.RunRuleDirect(oRule) 
	
	'close the file
	ExportedPart.Close
Next

The "iPartExport" rule should also be added in the master/original iPart file. It will be copied into the newly created models due to the fact they are copies of the original. This is the 'iPartExport' rule:

Dim b As PartDocument
b = ThisApplication.ActiveDocument

Dim c As iPartFactory
c = b.ComponentDefinition.iPartFactory
c.Delete

b.Save

 

 

 

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report