Message 1 of 3
I logic program for adding and constraining components but i don't know how to add multiple assembly with the same program
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi All,
I write a program to add the components in an assembly and give constrains but I don't know how to add multiple assemblies with the same program i tried creating a panel number as integer and adding it to the name of my component but i ended up getting multiple panel like this. can anyone help me with this
Attached the code below
'Directing to the part folder Dim PartsFolder As String = "Z:\Jobs-Quotes\Others\Ghost\Generative design\Seamless Balustrade\FFTM" 'Place Faceplate Dim FaceplateComp = Components.Add("_Faceplate", PartsFolder & "/faceplate.ipt", position := Nothing, grounded := False, visible := True, appearance := Nothing) 'Place Baluster Dim BalusterComp = Components.Add("_Baluster", PartsFolder & "/seamless baluster.ipt", position := Nothing, grounded := False, visible := True, appearance := Nothing) 'get Height from FFL Dim Handrail_height_from_FFL, Faceplate_to_FFL, Baluster_height_below_FFL As Double Handrail_height_from_FFL = InputBox("Enter the Handrail height from FFL", "Height from FFL", 1100) Baluster_height_below_FFL = InputBox("Enter the Baluster height below FFL", "Height below FFL", 585) Faceplate_to_FFL= InputBox("Enter thedistance from Faceplate to FFL", "Faceplate to FFL", 120) 'Parameter Baluster Parameter("_Baluster", "BalusterHeight_Above_FFL") = (Handrail_height_from_FFL-15)+Faceplate_to_FFL Parameter("_Baluster", "BalusterHeight_Below_FFL") = Baluster_height_below_FFL - 3 'constrain Faceplate to baluster Constraints.AddFlush("SideFlush_Faceplate_Baluster", "_Faceplate", "SideFlush_Faceplate", "_Baluster", "SideFlush_Baluster", offset := 0.0, biasPoint1 := Nothing, biasPoint2 := Nothing) Constraints.AddMate("BackMate_Faceplate_Baluster", "_Faceplate", "FrontMate_Faceplate", "_Baluster", "BackMate_Baluster", offset := 0.0, e1InferredType := InferredTypeEnum.kNoInference, e2InferredType := InferredTypeEnum.kNoInference, solutionType := MateConstraintSolutionTypeEnum.kNoSolutionType, biasPoint1 := Nothing, biasPoint2 := Nothing) Constraints.AddFlush("TopFlush_Faceplate_Baluster", "_Faceplate", "TopFlush_Faceplate", "_Baluster", "XZ plane", offset := 0.0, biasPoint1 := Nothing, biasPoint2 := Nothing) 'Place Undercap Dim Comp = Components.Add("_Undercap", PartsFolder & "/undercap.ipt", position := Nothing, grounded := False, visible := True, appearance := Nothing) 'Constrain Undercap Constraints.AddMate("SideMate_Baluster_Undercap", "_Baluster", "SideFlush_Baluster", "_Undercap", "XY plane", offset := 0.0, e1InferredType := InferredTypeEnum.kNoInference, e2InferredType := InferredTypeEnum.kNoInference, solutionType := MateConstraintSolutionTypeEnum.kNoSolutionType, biasPoint1 := Nothing, biasPoint2 := Nothing) Constraints.AddMate("CentreMate_Baluster_Undercap", "_Baluster", "XY plane", "_Undercap", "YZ plane", offset := 0.0, e1InferredType := InferredTypeEnum.kNoInference, e2InferredType := InferredTypeEnum.kNoInference, solutionType := MateConstraintSolutionTypeEnum.kNoSolutionType, biasPoint1 := Nothing, biasPoint2 := Nothing) Constraints.AddFlush("TopFlush_Baluster_Undrecap", "_Baluster", "XZ plane", "_Undercap", "XZ plane", offset := (Handrail_height_from_FFL-7.5)+Faceplate_to_FFL, biasPoint1 := Nothing, biasPoint2 := Nothing) 'Place Baluster Endcap Dim BalusterBotEndcapComp = Components.Add("_BalusterBotEndcap", PartsFolder & "/seamless baluster bot ec.ipt", position := Nothing, grounded := False, visible := True, appearance := Nothing) Constraints.AddUcsToUcs("Endcap_to_Baluster", "_Baluster", "origin", "_BalusterBotEndcap", "origin", xOffset := 0, yOffset := -Baluster_height_below_FFL, zOffset := 0) 'Get number of balusters Dim NumberOfBalusters As Double NumberOfBalusters = InputBox("Enter the Number of Balusters", "Number of Balusters 1 - 15 max", 10) 'Pattern Baluster Dim rectPattern = Patterns.AddRectangular("Baluster_pattern", {"_Baluster","_BalusterBotEndcap"}, NumberOfBalusters, -110, Nothing, "X Axis", columnNaturalDirection := True, rowCount := 1, rowOffset := 1.0 in, rowEntityName := "Y Axis", rowNaturalDirection := True) Parameter("_Faceplate", "FacePlate_length") = NumberOfBalusters * 110 Parameter("_Undercap", "uc_ln") = NumberOfBalusters * 110