Frame Generator Template & Linking?

Frame Generator Template & Linking?

rprivittB3TTG
Enthusiast Enthusiast
356 Views
5 Replies
Message 1 of 6

Frame Generator Template & Linking?

rprivittB3TTG
Enthusiast
Enthusiast

I am attempting to automate building Frame Generator assemblies via use of templates.

 

Currently, I have two templates: The Master Frame.iam template and the Skeleton.ipt sketch template. I have developed a Triggered Rule that opens a Form when starting a new Frame and Skeleton. All this is working fine.

 

This image shows the Master Frame.iam Form with the Skeleton.ipt already assembled into the Master Frame.iam tempalate.

rprivittB3TTG_0-1647960657326.png

 

This image shows only the Skeleton.ipt Form and the Skeleton.ipt off to the right.

rprivittB3TTG_1-1647961028848.png

 

 

I currently have to start a new Master Frame and a new Skeleton for each design. I then place the New Skeleton.ipt into the assembly Grounded at the origin of the New Master Frame.iam. This is also working fine. However, the Parameters that populate the Drawing Title Block reside in the Master Frame.iam template. Yet, the driving dimensional Parameters reside in the Skeleton.ipt template. I have figured out how to Link the Master Frame.iam template Parameters to the Skelton.ipt template Parameters so that I would only need to enter the dimension and title block information in the Master Frame.iam Form.

 

Here is the challenge:

 

Links work explicitly on a file name. Since the Skelton.ipt points to the Master Frame.iam template by name, the Skeleton.ipt will not link properly on a New Master Frame.asm file. It only links to the Master Frame.iam template.

 

This image shows the Parameters of the Sketelon.ipt template. Notice that under the User Parameters, I have successfully linked the Master Frame Assy.iam (for discussion sake, I am using a more generic naming in this post).

rprivittB3TTG_2-1647961379728.png

 

How can I make that Link point dynamically to the new .iam name?

 

I would like to avoid using iLogic Rules to do this. However, that doesn't seem likely. Any suggestions and actual code would be very helpful.

0 Likes
357 Views
5 Replies
Replies (5)
Message 2 of 6

dalton98
Collaborator
Collaborator

I copied this from a course I took on adding and deleting components. I havn't tested any of it yet, but it sounds like this is what your after.

 

ElseIf ScrewdriverCap = "Standard" Then

Dim componentA = Components.Add("screwdriver_cap_Standard:1", "screwdriver_cap_Standard.ipt", position := Nothing, grounded := False, visible := True, appearance := Nothing)

Components.Delete("screwdriver_cap_Long:1")

Components.Delete("screwdriver_cap_ExtraLong:1")

Parameter("screwdriver_body:1", "Body_Color") = ScrewdriverColor

Parameter("screwdriver_cap_Standard:1", "Color") = ScrewdriverColor

Constraints.AddMate("Mate1", "screwdriver_body:1", "MateFace", "screwdriver_cap_Standard:1", "MateFace",

                    offset := 0.0, e1InferredType := InferredTypeEnum.kNoInference, e2InferredType := InferredTypeEnum.kNoInference,

                    solutionType := MateConstraintSolutionTypeEnum.kNoSolutionType,

                    biasPoint1 := Nothing, biasPoint2 := Nothing)

Constraints.AddInsert("Insert1", "screwdriver_body:1", "InsertEdge", "screwdriver_cap_Standard:1", "InsertEdge",

                      axesOpposed := True, distance := 0.0, lockRotation := False, biasPoint1 := Nothing, biasPoint2 := Nothing)

Constraints.AddAngle("Angle1", "screwdriver_body:1", "XY Plane", "screwdriver_cap_Standard:1", "XY Plane",

                     angle := 0.0, solutionType := AngleConstraintSolutionTypeEnum.kDirectedSolution,

                     refVecComponent := Nothing, refEntityName := Nothing, biasPoint1 := Nothing, biasPoint2 := Nothing)

0 Likes
Message 3 of 6

dalton98
Collaborator
Collaborator

Just to comment on the code. To add the skeleton frame you would use:

Dim componentA = Components.Add("screwdriver_cap_Standard:1", "screwdriver_cap_Standard.ipt", position := Nothing, grounded := False, visible := True, appearance := Nothing)

 

And to change the skeleton dimensions you would use:

Parameter("screwdriver_cap_Standard:1", "Color") = ScrewdriverColor

0 Likes
Message 4 of 6

rprivittB3TTG
Enthusiast
Enthusiast

Thanks for your reply @dalton98 . I will study that a bit. I am not that versed at iLogic code. But my first impression is that it is missing the mark of what I am wanting.

 

I think I have code for constructing a file name out of parameters (something else I want to do). I anticipate using that iLogic Dim name as the Skeleton name that gets saved and also substituted for the template name.

0 Likes
Message 5 of 6

dalton98
Collaborator
Collaborator

Ok so this is how im thinking about it...

Since the skeleton frame is dependent on the master frame you can put all of your parameters in the master frame. From there you could create the skeleton.ipt using ilogic. The code would look something like this:

Dim oAssy As AssemblyDocument
oAssy = ThisApplication.ActiveDocument

Dim skeletonTemplate As String
skeletonTemplate = "C:\SkeletonTemplate.ipt"

'create skeleton part Dim skeletonPart As PartDocument skeletonPart = ThisApplication.Documents.Add(DocumentTypeEnum.kPartDocumentObject, skeletonTemplate, False)
'set skeleton paramaters offsetParam = skeletonPart.ComponentDefinition.Parameters.Item("OFFSET_FRONT") offsetParam.Value = 0.25 * 2.54 lengthParam = skeletonPart.ComponentDefinition.Parameters.Item("SK_LENGTH") lengthParam.Value = LENGTH * 2.54
'save skeleton part as file name Dim skeletonPartSave As String skeletonPartSave = "C:\Project\Skeleton" & lengthParam.Value/2.54 & ".ipt" skeletonPart.SaveAs(skeletonPartSave, False) skeletonPart.Close
'add skeleton part to assembly at 0,0,0 and grounded Dim componentA = Components.Add("Skeleton:1", skeletonPartSave, position := Nothing, grounded := True)

 

0 Likes
Message 6 of 6

rprivittB3TTG
Enthusiast
Enthusiast

This may be a good path. I see a few tweaks, but it looks like it has a few attributes that will help me a lot. I will try to test some of this code today (after I put out a few production fires).

 

Thanks.

0 Likes