Im trying to remap cameras by hitting F6, picking up their point and running RemapCplane command. Some of them work, but most of them fails, end up rotated, in wrong place. Normal objects work, but cameras behave differently.
If anyone has any reliable script that accomplishes the same I would be extremely grateful.
Unfortunately same behaviour it may be because Im remapping it from a detail view? I may need to script something that recreates the camera rather than remapping the existing one, although I will probably be fired by then (damn that autocad culture)…
Yes, it worked - the camera landed 90 degrees off, but rotating it in place worked. I’ll try to improve it later, but for this week it will be enough to save my dwindling career. Thank you very much!
If you knew by any chance if there is also any way to call that named view camera object from a script or via a command I’d be literally grateful for eternity.
That I do not know… let me poke around a little. But it should not be hard to remap via a script, ignoring the widget - let me have a try - you want to remap the current view from the current to a different plane, correct?
@Daniel_Krajnik - yes, it is possible to remap the current view’s camera.
See if this does what you need - it might
I’ve modified it slightly to remap cameras from arbitrary CPlanes listed in a ComboListBox:
import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino
vp = sc.doc.Views.ActiveView.ActiveViewport
named_cplanes = [i.Name for i in sc.doc.NamedConstructionPlanes]
selected_cplane_name_from = rs.ComboListBox(sorted(named_cplanes), "Cplane to Map from")
selected_cplane_name_to = rs.ComboListBox(sorted(named_cplanes), "Cplane to Map to")
for i in sc.doc.NamedConstructionPlanes:
if i.Name == selected_cplane_name_from:
plane1 = i.Plane
if i.Name == selected_cplane_name_to:
plane2 = i.Plane
xform = Rhino.Geometry.Transform.PlaneToPlane(plane1, plane2)
info = Rhino.DocObjects.ViewportInfo(vp)
info.TransformCamera(xform)
vp.SetCameraLocation(info.CameraLocation, False)
vp.SetCameraTarget(info.TargetPoint, False)
vp.SetCameraDirection (info.CameraDirection, True)
vp.CameraUp = (info.CameraUp)
sc.doc.Views.Redraw()
I need to read up more on Matrix Transformations in Rhino. One area of improvement I think would be retrieving xforms from blocks are remapping view without using named construction planes. I’ve organized the drawings so that each Make2D of the 3D model is in separate file, so there is only one xform for each view, which might be bound (to their GUIDs?) so to automate this process further.