MoI discussion forum
MoI discussion forum

Full Version: Save custom CPlane(s)

From: Mindset (IGNITER)
24 Jun 2022   [#1]
Hey Everyone !

Can we save custom CPlane(s), globally or in the model?

Thanks ,
MindSet
From: Michael Gibson
24 Jun 2022   [#2] In reply to [#1]
Hi MindSet, sorry no there isn't anything set up for that currently. Probably the best way currently would be to make a plane object or 2 perpendicular lines for the cplane location that you want to save.

- Michael
From: Mindset (IGNITER)
27 Jun 2022   [#3] In reply to [#2]
Maybe set this as a wish-list item ?

Thank You Michael !
From: Larry Fahnoe (FAHNOE)
28 Jun 2022   [#4] In reply to [#3]
Hi MindSet,

Although I've not looked into writing the script, you might consider looking at the View Manager script https://moi3d.com/forum/index.php?webtag=MOI&msg=10028.31 as the basis for something to accomplish what you're asking for. Teddy took a unique approach to saving the additional information needed as a .views.json file, so not a global setting but unique to the file.

--Larry
From: Mindset (IGNITER)
25 Jul 2022   [#5] In reply to [#4]
Thank you Larry,
Appreciate it Sir.

MindSet
From: Larry Fahnoe (FAHNOE)
25 Jul 2022   [#6] In reply to [#5]
Hi MindSet,

Dusting off my earlier tinkering with setting a CPlane via a script, the only means that I'm aware of to create a CPlane is moi.view.setCPlaneInteractive() which, as its name implies, brings up the CPlane dialog. So, not really a means of creating a CPlane from some previously stored information. There may be other functions available, I'm just not aware of them.

--Larry
From: Michael Gibson
25 Jul 2022   [#7] In reply to [#6]
Hi Larry, scripting interface for cplanes is as follows:

moi.view.setCPlane( Frame, ApplyToAllViews, OrientOrthoViews ); - takes a required coordinate frame parameter, optional boolean parameter for whether to apply to all views or 3d view only, and optional boolean parameter for whether to orient ortho views or keep them in world.

moi.view.getCPlane(); - returns coordinate frame for the active cplane.

moi.view.setCPlaneInteractive(); - runs the user interactive method for setting the cplane same as pushing the View > CPlane button.

moi.view.resetCPlane(); - sets the current cplane to world.

- Michael
From: bemfarmer
25 Jul 2022   [#8] In reply to [#6]
In the Elastica2 and Clothoid scripts, pointpicker is used to get cplane.
I think that this is true.
From Michael's help from 2013.

var pointpicker = moi.ui.createPointPicker();
if ( !GetPoint( pointpicker ) ) return;
var cplane = pointpicker.ptframe;

- Brian
From: Mindset (IGNITER)
7 Nov 2022   [#9] In reply to [#4]
Thanks Larry,

It's still a challenge because the script stores views but not CPlane(s).
I tried to store data from "moi.view.getCPlane();" into the Jason file, but I don't know its properties nor how to work with them to restore it from the subsequently retrieved data.

It would be nice if we could store CPlanes as construction planes (unprintable..? objects) within the .3dm file!

Any hints, anyone?
- Mindset
From: Michael Gibson
7 Nov 2022   [#10] In reply to [#9]
Hi Mindset,

re:
> I tried to store data from "moi.view.getCPlane();" into the Jason file, but I don't know its properties

The return from moi.view.getCPlane() is a coordinate frame object, it has properties for: .origin, .xaxis, .yaxis, and .zaxis , and each of those points and vectors have properties for .x .y and .z .

When you want to make a coordinate frame object, you call moi.vectorMath.createFrame() and on the coordinate frame you can set it using the .set() method which takes 9 values: frame.set( originx, originy, originz, xaxisx, xaxisy, xaxisz, yaxisx, yaxisy, yaxisz ); - the z axis is automatically calculated from the x and y axes and isn't set by itself.

- Michael
From: Frenchy Pilou (PILOU)
16 Sep   [#11]
A very simple way for make a library of CPlane (s) :)

Draw a little surface ( polys...) Export it (single or several) with their orientation !

Just Import them when necessary and draw the Cplane from it! :)

So you can have several CPlane(s) in the same project!
From: Mindset (IGNITER)
17 Sep   [#12] In reply to [#11]
Pretty simple indeed.
Bravissimo, Frenchy Pilouâť—
From: Frenchy Pilou (PILOU)
17 Sep   [#13] In reply to [#12]
CPlane Manager by Samardac can add a little help but...

https://moiscript.weebly.com/truc-astuces-2.html
From: Mindset (IGNITER)
17 Sep   [#14] In reply to [#13]
Merci Beaucoup