iLogic AddContentCenterPart

iLogic AddContentCenterPart

Anonymous
Not applicable
3,806 Views
8 Replies
Message 1 of 9

iLogic AddContentCenterPart

Anonymous
Not applicable

Good evening everyone!! 

 

I was in the process of writing a bit of code where I can automate placement of content center parts. The code works on an internal rule but when I copy the exact rule to an external one it says it can't find the content center family

 

Untitled.jpg

 

SyntaxEditor Code Snippet

Dim NozzlePath As String = "Tube & Pipe:Fittings:Couplings"
Dim NozzleFamily s String = "ASME B16.11 Half Coupling Threaded - Class 3000"

Dim componentB = Components.AddContentCenterPart("Nozzle1", NozzlePath, NozzleFamily, {"ND", "3" }, position := Nothing, grounded := False, visible := True, appearance := Nothing) 

 

0 Likes
3,807 Views
8 Replies
Replies (8)
Message 2 of 9

MjDeck
Autodesk
Autodesk

When running in an external rule, you have to explicitly specify the language that you're using for the path and family. To do that, add this line to the top of the rule:

Components.ContentCenterLanguage = "en-US"

More info here.
It would be a good idea for iLogic to provide a more specific error message in this case. We should be able to do that in a future release.

 


Mike Deck
Software Developer
Autodesk, Inc.

Message 3 of 9

DFitting
Contributor
Contributor

I'm having a similar issue with the new 

Components.AddContentCenterPart

 Ive got it to place the pipe in, but I am only able to place in the content centers default length, ie. 50" long

 

as we know, Inventor default content center has the PL parameter set to an expression of [0.001;;;50] which I know is where the 50 is coming from. I feel like I'm missing a step, or maybe it's not possible at the time to place an expressional part such as a pipe. 

 

This is some test code, it is placing the 1st component but when I uncomment the 2nd one @ 20" it won't place it. 

 

SyntaxEditor Code Snippet

Dim componentA = Components.AddContentCenterPart("occNameA", "Tube & Pipe:Conduits:Pipes", "ASME B36.10M Pipe", 
	                                        {"Size_Designation","3 - Schedule 40" ,"PL",50}, 
	                                        position := Nothing, grounded := False, 
	                                        visible := True, appearance := Nothing)
											
'Dim componentB = Components.AddContentCenterPart("occNameB", "Tube & Pipe:Conduits:Pipes", "ASME B36.10M Pipe", 
'	                                        {"Size_Designation","3 - Schedule 40" ,"PL",20}, 
'	                                        position := Nothing, grounded := False, 
'	                                        visible := True, appearance := Nothing)

 

 

0 Likes
Message 4 of 9

MjDeck
Autodesk
Autodesk

That's right: it's not possible at this time to add a part with a custom size. As it is, the function will add it as a Standard part, with the default size. We should be able to support custom parts with variable sizes in a future release.


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes
Message 5 of 9

DFitting
Contributor
Contributor

Is it currently possible to add a sub-assembly into an assembly and then from that top-level assembly run a rule that could use the Components.Add to the sub-assembly?

 

Something similar to this maybe?

 

SyntaxEditor Code Snippet

If openDoc.DocumentType = kAssemblyDocumentObject Then  
    For Each docFile In openDoc.AllReferencedDocuments      
        FNamePos = InStrRev(docFile.FullFileName, "\", -1)        
        docFName = Mid(docFile.FullFileName, FNamePos + 1, Len(docFile.FullFileName) - FNamePos)

        If docFile.IsModifiable = True Then          
			assemblyDoc = openDoc  
			assemblyDef = assemblyDoc.ComponentDefinition
			Dim componentA = docFile.Components.Add("nozzle 1", "C:\Users\Public\2019\PIPES\PIPEC2-40-8.ipt",
position := Nothing, grounded := True, visible := True,
appearance := Nothing) End If Next End If

 

0 Likes
Message 6 of 9

N-Roith
Enthusiast
Enthusiast

Hello Mike,

 

is it possible in 2021 to change standard parts (profiles, tubes...) with custom sizes?

 

thanks,

 

Norman

0 Likes
Message 7 of 9

JaneFan
Autodesk
Autodesk

Hi @DFitting , 

 

I guess you have figured out that it is possible as long as you have the rule in sub assembly. 🙂




Jane Fan
Inventor/Fusion QA Engineer
0 Likes
Message 8 of 9

JaneFan
Autodesk
Autodesk

Hi @N-Roith , 

 

Sorry to tell that this part hasn't been implemented yet.




Jane Fan
Inventor/Fusion QA Engineer
0 Likes
Message 9 of 9

Yijiang.Cai
Autodesk
Autodesk

This has been implemented within Autodesk Inventor 2024. Please review the Inventor 2024 What's New article here. For more information regarding how you may leverage the feature, and please review this page. Thanks!

Thanks,
River Cai

Inventor Quality Assurance Team
Autodesk, Inc.
Email: River-Yijiang.Cai@autodesk.com
0 Likes