A week ago, I took a question from the discussion page on my PowerCopy Instantiator Script:
In regards to the Powercopy Instantiator Macro: I know this tool works, if at least used in a certain manner, because someone posted a video tutorial demonstrating the tool use (to which you also responded to). However, I am encountering difficulty using it. Leaving aside rough edges, I am having difficulty understanding how to get this tool to function to automate my powercopy instantiation. My powercopy instantiation works manually–the instance instantiates in my context–I want to replicate the manual instantiation with your automating tool. At best I can get the script to instantiate one, the first powercopy, but then I seem to get the same error described above and cannot fix it by checking “Use Iterate” in the first interface and not checking the “Iterate” options in the second interface. I am getting many more instantiations attempts than I want. I am going to try different approaches and older versions to see how it is fares. EDIT: The problem I seem to be getting basically is that my instance is based on 4 points. When I use this tool to automate (and is actually successful on the first powercopy instantiation), the second instantiation uses the same point from the geometric set for INPUT1 and then tries to create another instantiation–which fails. –D -Apple
Apple, Thanks for posting. I know the Powercopy Instantiator is a bit rough around the edges, and all comments about it are welcome.
As for your inquiry, I may have an idea of how your PC (powercopy) isn’t working with the PC Instantiator. When first learning how to make Powercopies, most people are trained to make powercopies based upon points. This is common where the user is trying to panelize a system manually with a grid of points on a surface. However, the PC Instantiator cannot use this type of framework for the following reason: Point-to-Point manual PC instantiation uses the last point of the previous PC to be the first point of this current PC. So, users are encouraged to employ a new type of input creation on their powercopies that works sequentially based on Geometrical Sets. For example, if in your powercopy, you want to use the four corner points of a panel to instantiate them, don’t set up your PC inputs as points, but rather use inputs that can create intersection points inside the Powercopy. In the rectangular panel example to the right, the Horizontal Planes set is ordered from right-to-left and the Vertical Planes set is ordered from bottom-to-top. The rectangular panel PC is still based upon points, but rather than them being the inputs, they are created from the input intersections of a Left Plane, Right Plane, Top Plane, and Bottom Plane, all intersecting the non-iterative surface Main Surface. This way, a user can make all the points for each respective PC inside the PC, not limiting the instantiation to one row or column. I hope this helps. Feel free to contact me at nicholas.pisca at gehrytechnologies dot com if you have any questions. -God
Recently, Apple responded with this email:
Thanks for the quick response on GTWiki. I probably should have consulted earlier and in more detail. I am a student so I tried to figure out a solution on my own because I thought my difficulties are arising from my inexperience with the program.
I believe I understand your response. I am in the process of trying to make it work for me. The only issue is that I am using a set of planes similar to your example except for my planes are angled from the cartesian planes to give me a diamond shaped grid. This I believe I will resolve because it should not matter if its top, bottom, left, right, it could also be side1..side4 of a 4 sided panel. A question, as far as using intersections of planes as inputs for my panel powercopy, is: if I want your Instantiator tool to work for me–for solutions of planes that do not intersect the surface being panelized–how do I have the tool discard them and continue to find solutions? Check the update individual instances box?
More crucially–I am trying to parameterize the number of instances and spacing of the planes that intersect to create the grid for my power copy panels. The planes in the ordered geometrical sets. Ideally, I would like to make spacing dependent on the number of instances–for example place x (parameter) number of planes along line spaced evenly or in some regular pattern. The problem that I am struggling to overcome is that I cannot make my parameter x set to an actual parameter in the program. Using planes repetition, plane system, etceteras, I cannot create a parameter that I can change that will create a geometrical set of x number of planes. If I right click on the instances box on these commands, I do not have the option edit the formula and set it to a parameter.
Actually, I have been able to do this successfully with the rectangular pattern tool– with lines and points (I haven’t actually tried using this tool with planes). However then I cannot select individual elements of the pattern as inputs to copy to create my powercopy file–I can only paste in the full pattern into the new file not 4 individual elements (points and lines, and I assume planes also) of the pattern.
Anyway, so I am trying to script the generation of my geometrical sets of planes so that I can make instances a variable that I can easily change. I tried recording a macro of a command and then editing it to try to help me write the script. How do I use x as a variable in my script for a list? For example, ‘do command alpha x times: alpha1 . . . to alphax’–like in a mathematical function f [subscript n], n=(1 … x): function of even function f(x subscript n): f(x subscript 1), f(x subscript 2), … f(x subscript n). I know I am not explaining this well, but in the VBscript it literally has each creation of the plane scripted:
Sub CATMain() Set documents1 = CATIA.Documents Set partDocument1 = documents1.Item("Part1.CATPart") Set part1 = partDocument1.Part Set hybridShapeFactory1 = part1.HybridShapeFactory Set originElements1 = part1.OriginElements Set hybridShapePlaneExplicit1 = originElements1.PlaneXY Set reference1 = part1.CreateReferenceFromObject(hybridShapePlaneExplicit1) Set hybridShapePlaneOffset1 = hybridShapeFactory1.AddNewPlaneOffset(reference1, 0.000000, False) Set hybridBodies1 = part1.HybridBodies Set hybridBody1 = hybridBodies1.Item("Geometrical Set.1") hybridBody1.AppendHybridShape hybridShapePlaneOffset1 part1.InWorkObject = hybridShapePlaneOffset1 part1.Update Set relations1 = part1.Relations Set parameters1 = part1.Parameters Set length1 = parameters1.Item("Plane\Length") Set formula1 = relations1.CreateFormula("", "", length1, "(distance(`xy plane`,`Geometrical Set.1\Plane.1`)) / 10") Set reference2 = part1.CreateReferenceFromObject(hybridShapePlaneOffset1) Set hybridShapePlaneOffset2 = hybridShapeFactory1.DuplicateGSMSpec(reference2) Set reference3 = part1.CreateReferenceFromObject(hybridShapePlaneOffset2) Set reference4 = part1.CreateReferenceFromObject(hybridShapePlaneExplicit1) hybridShapeFactory1.SetReferenceElemForMultiple reference3, reference4 '...........................................................to...................................................................................................... Set relations17 = part1.Relations Set parameters17 = part1.Parameters Set length17 = parameters17.Item("Part1\Geometrical Set.1\Geometrical Set.2\Plane.9\Length") Set formula17 = relations17.CreateFormula("", "", length17, "(distance(`xy plane`,`Geometrical Set.1\Plane.1`)) * 8 / 10") Set reference48 = part1.CreateReferenceFromObject(hybridShapePlaneOffset10) Set hybridShapePlaneOffset18 = hybridShapeFactory1.DuplicateGSMSpec(reference48) Set reference49 = part1.CreateReferenceFromObject(hybridShapePlaneOffset18) Set reference50 = part1.CreateReferenceFromObject(hybridShapePlaneExplicit1) hybridShapeFactory1.SetReferenceElemForMultiple reference49, reference50 Set relations18 = part1.Relations Set parameters18 = part1.Parameters Set length18 = parameters18.Item("Part1\Geometrical Set.1\Geometrical Set.2\Plane.10\Length") Set formula18 = relations18.CreateFormula("", "", length18, "(distance(`xy plane`,`Geometrical Set.1\Plane.1`)) * 9 / 10") End Sub
Basically, I want to make my grid construction parametric–in that I want the number of planes to be linked to a parameter. Any help finding a solution–whether scripting or non-scripting–to my problem would be appreciated.
Thanks for the help in advance,
I hope I can help out quickly, since you are on a short time line. 🙂
As for your first question about updating the panelization, even when the geometry stops on an error, the PC Instantiator was designed to skip any problematic panels. For example, lets say your facade is large triangle, but you are instantiating a diamond grid of four sided panels. There will be cases where the panels will be on the edge of the facade which will result in an instantiation error. Also, there will be cases where the panel doesn’t have any valid inputs at all. Anticipating this, I put in a checkbox on the main dialog box of the PC Instantiator for “Updating” the PC’s or UDF’s. This is called “Update Instantiations Individually.”
After you run your instantiation, you will all possible combinations of the facade, regardless if they are updated or not. To resolve any extraneous non-updatable UDF’s or PC’s, just hit CTRL+U at the end of the batch process and keep clicking “Delete” or “Deactivate” depending upon your preferences.
As for the second half of your inquiry, I understand your need for a variable plane tool. This is very handy, however there is no single answer to this issue. All solutions have drawbacks and quirks, but one may work for your scenario.
1.) Write a small VB script to make different planes based upon variables.
This isn’t a live solution, but if you are working on making several iterations of the facade panelization with the PC Instantiator macro, it’s probably the fastest way to get several options quickly. Unfortunately, I’m currently blogging from a computer that doesn’t have DP or CATIA, so I won’t be able to debug this, but I’ll give you a good starting point: (Note, only run this from a Part, not a Part in a Product)
OffsetDist = 2000 'VB is always in mm PanelCount = 20 Set MyDoc = CATIA.ActiveDocument Set MyPart = MyDoc.Part Set MyHSFactory = MyPart.HybridShapeFactory Set oe1 = MyPart.OriginElements Set xyplane = oe1.PlaneXY Set Set1 = MyPart.HybridBodies.Item(1) for x = 1 to PanelCount Set CurPlane = MyHSFactory.addnewplaneoffset(xyplane, (PanelCount * OffsetDist), true) set1.appendhybridshape curplane MyPart.Updateobject curplane next x
That sample code should be a good place to begin for you (it’s completely from memory). You can modify it to move your start plane by using different dimensions. Like I mentioned before, this situation isn’t live, so you’ll have to run this plane system code to produce several starting files, then run the PC Instantiator to fill in the different facade panelizations.
2.) Use the Rectangle Pattern command without scripting to make a variable plane system. The best way to make variable plane systems with literally a live “x” number of plane that could be changes with a simple integer parameter at the top of the file, is the wonderful Rectangle Pattern. Unfortunately, Rect Patt’s are pretty much useless thereafter. They are terrible parents for geometry in the traditional modeling sense, because when you make a Rect Patt of anything not connected (“non-connex” in CATIA-speak), essentually you are making a single object. The developers of CATIA create the illusion that you have several objects, but they are really just one. Using Rect Patt’s are usually a dead end once the geometry gets complex, but I was able to do some interesting things with this bazarre functionality. For example I was able to use this on the Glendale Satellite Library project with Juan Azulay to make some interesting patterns inside panels. However, infrastructurally, it’s not that beneficial to use Rect Patt’s to start up your diamond grid on the facade. Oh yeah, also, you can’t use Rect Patt’s with my PC Instantiator, since it’s one object and not a Geometrical Set of planes.
3.) Lastly, you can use Knowledge Patterns to instantiate your PC’s. KP’s allow for a user to pick a X dimension and a Y dimension, and this will populate a facade with panels in a similar way to the PC Instantiator macro. And this will be live. Downsides….where do I begin. KP’s use the Knowledgeware language. This interface has a terrible setup which is hard to debug and the documentation is pathetic. It takes a very long time even for advanced DP users to decipher this cruddy interface and once it’s completed, it is a bear to make portable. Files must be stored locally in catalogs in Knowledgeware libraries and directories. There is little to no information about KP’s on the web, whereas the VB forums on CATIA are extensive and comprehensive.
Lastly, use of KP’s displays a designers shortsightedness; there is a craze right now to use KP’s, and most of these users do not look at the big picture. The instantiation process of panels is usually just a small fraction of the entire architectural process. Panels are rationalized, replaced, analyzed, redesigned, exported, reported, sent to drawings, and so on and so on. KP’s only do the patterning. If a user makes an executive decision early in the design process, using VB is far more profitable in time and effort: VB can handle panelizing, reporting, drawing generation, rationalization, analysis, replacement, unique testing, and so on and so on.
I hope this helps you out for now. I would look at my sample VB code I mentioned above and modify it to make several scenarios. I know it’s not live, but you can work on that with objects called Reactions after your review on Tuesday. This program has so many possibilities!