Problems remapping cameras

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.

Hi Daniel - try making a named view, turning on the camera for the named vier and select and re-map that.

-Pascal

Thanks, I will try that now. Im not sure though why creating a namedview would change camera’s behaviour?

Unfortunately same behaviour :frowning: 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)…

Hi Daniel - rather than ShowCamera, use the named view panel to show the camera widget - that behaves more like a real object.

-Pascal

1 Like

I didnt know about it, thabk you its a great idea, but when I try to RemapCplane it says “Unable to transform 1 object”?

hm- worked here, I think - but I think I had the WIP open, let me try V7…

-Pascal

1 Like

Sorry, I just realized that it may have been because Ive had Copy option turned on as Yes in RemapCplane command. Let me try again…

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

ReMapCamera.py (938 Bytes)

To use the Python script use RunPythonScript, or a macro:

_-RunPythonScript "Full path to py file inside double-quotes"

-Pascal

1 Like

Holy sheet it works! Thank you!

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.

Alos interestingly enough this issue did not occur - perhaps this script could be used for flipping/reversing views as well