MoI discussion forum
MoI discussion forum

Full Version: Lots of unkown

Show messages:  1  …  122-141  142-161  162-181  182-201  202-221  222-241  242-261  …  362-372

From: Cemortan_Tudor
18 Jul 2020   [#182]
move - expanded first actions - move + x/y/z/a initial conditions (earlier script respond after first pickedpoint)
s - bbox center

extrude - do backup as part is havelly changed from vanilla
p path
b both directions
c cap ends
d directional // changed - removed distance line and input distance (slightly buggy on surfaces if keypressed while moving mouse - I think it can't update in time and skips update factory)
f tapered/flip tapered
Numpad+ increase tapered angle by 15
Shift+Numpad+ increase tapered angle by 5
Numpad- decrease tapered angle by 15
Shift+Numpad- decrease tapered angle by 5
removed t as hotkey

boolean difference
for closed curves
initial and subtractive if both are on same parallel frame but different frame
move subtractive group to initial and do the boolean difference (made for side views where u see that u have 2 circle's but u cannot subtract cuz they have different frames)

Attachments:
BooleanDifference.js
Extrude.js
Move.js


From: Cemortan_Tudor
19 Jul 2020   [#183]
crv.evaluateCurvature - how can I access first and second pt of vector ? -> tried -> [], item(), getStartPt()
From: Michael Gibson
19 Jul 2020   [#184] In reply to [#183]
Hi Tudor,

re:
> crv.evaluateCurvature - how can I access first and second pt of vector ? -> tried -> [], item(), getStartPt()

There is not a first and second point returned, it returns one vector value (with .x, .y, .z - same as a point) for the curvature vector (K) of the curve in the osculating plane at that parameter value. Radius of curvature = 1 / Magnitude K.

https://en.wikipedia.org/wiki/Curvature#Osculating_circle

- Michael
From: Michael Gibson
19 Jul 2020   [#185] In reply to [#183]
re: crv.evaluateCurvature, here is some test code. Make a curve, select it and then push the Tab key and paste this in to the XYZ input control:

var crv = moi.geometryDatabase.getSelectedObjects().getCurves().item(0);
var pt = crv.evaluatePoint( crv.domainMin );
var K = crv.evaluateCurvature( crv.domainMin );
var f = moi.command.createFactory( 'line' );
f.setInput( 0, pt );
f.setInput( 1, moi.vectorMath.add( pt, K ) );
f.commit();

That will make a line showing the curvature vector. The radius of curvature is 1 / length of that line.

Curvature vectors are generally scaled up by quite a bit when used for visualization purposes. They tend to be small in their direct form.

- Michael
From: Cemortan_Tudor
19 Jul 2020   [#186]
thanks ! that's what i've needed !
From: Cemortan_Tudor
21 Jul 2020   [#187]
how can I get toplevel from a selection (ex:face or edge to object)
From: Michael Gibson
21 Jul 2020   [#188] In reply to [#187]
Hi Tudor,

re:
> how can I get toplevel from a selection (ex:face or edge to object)

var toplevel = subobj.getTopLevelParent();

- Michael
From: Cemortan_Tudor
23 Jul 2020   [#189]
Hi Michael !
is it possible to attach moi-html to chrome to have futures like object explorer/building html ?
or other ways to debug
From: Michael Gibson
23 Jul 2020   [#190] In reply to [#189]
Hi Tudor,

re:
> Hi Michael !
> is it possible to attach moi-html to chrome to have futures like object explorer/building html ?
> or other ways to debug

No, not currently. In the future I want to have a script debugger in MoI, it will involve a lot of work to make that happen though.

- Michael

Message 8665.191 was deleted


From: Cemortan_Tudor
1 Aug 2020   [#192]
Hi Michael !
I think this should rise an error
createPoint(moi.vectorMath.add(obj.getStartPt(), scaleVector(obj.evaluateTangent(obj.domainMin), -1))).commit() - correct state
createPoint(moi.vectorMath.add(obj.getStartPt(), scaleVector(obj.evaluateTangent(obj.domainMin)),-1)).commit() - should rise -> it creates an null point

function scaleVector(v, factor) ... return moi.vectorMath.createPoint(x,y,z)
From: Cemortan_Tudor
9 Aug 2020   [#193]
Hi Michael !
I'm working a script & I wanna optimize it ! it uses a lot of moi.vectorMath.add()
wanna ask what's the math behind that function ? mb will improve runtime (not to call internals todo math operations )
From: Michael Gibson
9 Aug 2020   [#194] In reply to [#193]
Hi Tudor,

re:
> it uses a lot of moi.vectorMath.add()
> wanna ask what's the math behind that function ?

Like this:

var PtA, PtB, Result;

<......>

Result.x = PtA.x + PtB.x;
Result.y = PtA.y + PtB.y;
Result.z = PtA.z + PtB.z;


- Michael
From: Cemortan_Tudor
10 Aug 2020   [#195]
scripts for edge selection :

I wanted ~ growLoop similar to Subd, with v4 it became possible
works only for 1 selected object -> possible multiple edge selection

_GrowSelectionTangecy - expands only once
_ExpandSelectionTangecy - expands full selection

testing files are on moi_objects.rar
I haven't done more optimization since ~ 140ms is good result on big_object test (started from 20s -> 2s -> 1.2s-> 0.140)

quick Notes:
factory.Update() + getCreatedObjects() - it's slow process - better avoid it
looping same object - debugging -> might have different selection order - idk why it's happening - have to place into java object
Ps: why getEndPt() != domainMax ?

Attachments:
moi_objects.rar
_ExpandSelectionTangecy.js
_GrowSelectionTangecy.js


From: Cemortan_Tudor
10 Aug 2020   [#196]
add point
D -> delete corners

Attachments:
AddPoint.js


From: Cemortan_Tudor
10 Aug 2020   [#197]
http://moi3d.com/forum/index.php?webtag=MOI&msg=8665.136
Shortcuts for manipulation:
Fillet; Inset; Shell ; Offset(Brep)

Numpad+ -> value + value/2
Shift+Numpad+ -> value + value/10
Numpad- -> value - value /3
Shift+Numpad- -> value + value/10
Numpad* -> value*2
Numpad/ -> value/2

//added
small adjustments
Ctrl+Shift+Numpad+ -> value +value/100
Ctrl+Shift+Numpad- -> value - value/100
r - reset distance to 0 -> to start new one

Attachments:
GetDistance.js


From: Cemortan_Tudor
12 Aug 2020   [#198]
Hi Michael
for offset - through point, I wanna store value for next op - have the same as previous - how shall I do it ? (temporary global save*)
From: Cemortan_Tudor
12 Aug 2020   [#199]
magic of offset ~ weird behavior

Attachments:
buggy_offset.3dm


From: Cemortan_Tudor
12 Aug 2020   [#200]
I've tested in other software to see if it's rly a problem !
Rhino Fails - buggy
DesignSpark Mechanical - buggy
Illustrator - it doest care about continuity
Fusion 360 - it maxed the continuity- when it breaks, will round corners

Image Attachments:
23123.jpg 


From: Michael Gibson
12 Aug 2020   [#201] In reply to [#198]
Hi Tudor,

re:
> for offset - through point, I wanna store value for next op - have the same as previous - how
> shall I do it ? (temporary global save*)

There's moi.command.setOption() and moi.command.getOption() that can be used for that.

The setOption works like: moi.command.setOption( 'string_id', val );

getOption goes like this:
var val = moi.command.getOption( 'string_id' );

One thing to watch out for is that getOption() will throw an exception if there isn't anything saved with that string id before, so you need to use it in a try/catch block like this:

var Val = 5;
try {
Val = moi.command.getOption( 'string_id' );
}
catch(e) {}

- Michael

Show messages:  1  …  122-141  142-161  162-181  182-201  202-221  222-241  242-261  …  362-372