Good Morning,
I'm trying to create multiple saved views from a list of coordinates, thank you to Volker to helping me to date with this! I have been made aware that it is possible to use the camera to set a position and then create a saved view from that. this works fine if you are trying to create a couple of saved views however I'm trying to create 30 or 40.. from what I understand of the camera node, it applies a camera position to a view between 3 and 8 therefore anything more than 5 saved views it wont do.
Does anybody have any ideas that might help?
Thanks in advance
Tom .
Hi Tom,
I'll file an enhancement so that a camera can save more views and leave them behind.
Meanwhile, the first few steps of the approach are correct. Saving the views then needs to be done by using a key-in. GenerativeComponents can issue Key-in commands to the application via the built-in KeyIn function. A sample script transaction would look like this:
transaction script 'Generate Saved Views' { Camera thisCam = new Camera("ViewGenCamera"); int viewNum = 3; thisCam.ViewNumber = viewNum; for (int i = 0; i < EyePoint.Count; ++i) { string viewName2 = "SavedView" + ToString(i + 1); thisCam.EyePoint = EyePoint[i]; thisCam.TargetPoint = Target; UpdateGraph(); string keyInString = "namedview save " + viewNum + " " + viewName2 + " GCSavedView"; KeyIn(keyInString); UpdateGraph(); } }
This generates as many views as there are replicated points in EyePoint (which must exist before inserting and executing this piece of script). Similarly a node "Target" of type Point must exist. This could a be a replicated point like EyePoint, and then would be indexed, as well.I hope this provides you with sufficient information to achieve what you were trying to achieve.Best success! Volker
Answer Verified By: L
Thank you for your help again!
I seem to be getting an error that doesn't make much sense to me, any ideas ?
i'm sure it is a 'user' error.
thanks in advance for your help!
My suggested solution implied that there are always multiple EyePoint instances, and only a single Target point. If either one of those could be singletons or replicated nodes (i.e. either a single point or a point containing multiple component or instance points within, as in a replicated point), then the script would have to change. It gets a bit more complicated and needs to emulate what replication would otherwise automatically resolve. (Just to recall: this is a work around to the fact that replication does not work for cameras and saved views beyond six saved views because of the limitation to six view windows that are available beyond the first two views that GC reserves for itself.)
transaction script 'Generate Saved Views' { Camera thisCam = new Camera("ViewGenCamera"); int viewNum = 3; thisCam.ViewNumber = viewNum; int eyeCnt = 1; int tgtCnt = 1; bool eyeRnk = EyePoint.Rank() > 0; bool tgtRnk = Target.Rank() > 0; if(eyeRnk) eyeCnt = EyePoint.Count; if(tgtRnk) tgtCnt = Target.Count; int theCnt = 0; // emulate matching replication if(!eyeRnk || !tgtRnk) theCnt = Max(eyeCnt, tgtCnt); else theCnt = Min(eyeCnt, tgtCnt); for (int i = 0; i < theCnt; ++i) { string viewName = "SavedView" + ToString(i + 1); if(eyeRnk) thisCam.EyePoint = EyePoint[i]; else thisCam.EyePoint = EyePoint; if(tgtRnk) thisCam.TargetPoint = Target[i]; else thisCam.TargetPoint = Target; UpdateGraph(); string keyInString = "namedview save " + viewNum + " " + viewName + " GCSavedView"; KeyIn(keyInString); UpdateGraph(); } }
HTH,
Volker
Marvelous!
...and you are welcome.