MoI discussion forum
MoI discussion forum

Full Version: Point Offset Script request

From: Moi3dFan
6 Feb   [#1]
There are problems in which it is required to place points equidistantly along a curve. I deallocate this every time through the circle + intersection. However, want a faster solution with an input field and slider.

Extras. It would be great if the point offset could be applied to the tangent points of the curve.

See screenshot. Thank you in advance!



Image Attachments:
2024-02-06_17-01-51.png 


From: Michael Gibson
6 Feb   [#2] In reply to [#1]
Hi Moi3dFan, usually for making rounded corners on a polyline you would use the Construct > Fillet command.

That also has an input field for the radius.

Do you need something different from that?

- Michael
From: Moi3dFan
6 Feb   [#3] In reply to [#2]
All that is required is the creation of points on the polyline, uniformly offseting points from selected points on the polyline, for further transformations.

And the additional question is about curve points, specifically creating additional CVs on the Hull to make the corners of the curve more pointed.
From: Moi3dFan
6 Feb   [#4] In reply to [#2]
Essentially, I want a macros to be executed that will perform the following sequence:
- Selected points on the polyline
- A circle is constructed from these points (customizable)
- Then the circle intersects with the polyline and creates two equidistant points
- The circle is removed

Thus we get the displacement of these points
From: Michael Gibson
7 Feb   [#5] In reply to [#4]
Hi Moi3dFan, please try the attached script.

Instructions for installing scripts are here:
https://moi3d.com/faq#Q:_How_do_I_install_a_plug-in_script.3F

You can click 2 points in the view to dynamically change radius, or type it in and there is a mode for generating points or for making a control point curve through the points.

Hope that is what you were looking for,

- Michael

Attachments:
AddCornerPoints.zip


From: Mik (MIKULAS)
7 Feb   [#6] In reply to [#5]
Hi Michael,

very useful script, thank you.

Only one question...when I select points on polylines curve and run the script error message appear "No polylines or polylines points selected" although the polylines points were selected before run the script.

If I select polyline curve as a whole script run without problem and all points are rounded.

Is it bug or I should select the points in different way?

Mik

Image Attachments:
AddCornerPoints.jpg 


From: Michael Gibson
7 Feb   [#7] In reply to [#6]
Hi Mik, it sounds like a bug but I'm not seeing it over here.

Could you please post the .3dm file with your polyline in it so I can test with it?

I'm also not sure what the behavior should be for making a curve when only some corners are selected. Currently it makes a control point curve out of the whole thing with tighter bends in the corners that are getting added points.

Thanks, - Michael
From: Mik (MIKULAS)
7 Feb   [#8] In reply to [#7]
Hi Michael,

the behaviour of script as I mentioned above is appeared in MoI V4, in V5 the script runs as you described in previous post.

Mik

Attachments:
AddCornerPointsTestFile.3dm


From: Michael Gibson
7 Feb   [#9] In reply to [#8]
Hi Mik, scripting access to object edit points is new in v5 so that's normal.

You'll need to run it in v5 for that part to work.

- Michael
From: Moi3dFan
7 Feb   [#10] In reply to [#9]
It works even better than intended! Thank you!

There are a couple things that could be improved:
- Points in "Make Point" mode are added to the polyline itself. You can made checkbox for this mode.
Of course, I can cut the curve by these points and then connect them, but I want a shortcut.

- Note that, in "Make curve" mode. If a polyline has only one point selected, then after applying the script the whole polyline turns into a curve. This is rather wrong, for I want to smooth out one point.
I have a solution though - I'll just detach the corner I want and apply the script.

Thank you for taking the time to do this, with scripts like this you make it very easy to work in your favorite program
From: Michael Gibson
8 Feb   [#11] In reply to [#10]
Hi Moi3dFan, you're welcome I'm glad that is useful.

re:
> - Points in "Make Point" mode are added to the polyline itself. You can made
> checkbox for this mode.
> Of course, I can cut the curve by these points and then connect them, but I want a shortcut.

I've updated the script (attached in message above) to have an additional polyline mode where it generates a polyline with the new points in it.


> - Note that, in "Make curve" mode. If a polyline has only one point selected, then
> after applying the script the whole polyline turns into a curve. This is rather wrong,
> for I want to smooth out one point.

I've also updated it so that it will only smooth selected points and leave unselected ones as sharp corners.

- Michael
From: Frenchy Pilou (PILOU)
8 Feb   [#12]
And seems working even Polylines are not planar!

And multiple! :)
From: Frenchy Pilou (PILOU)
8 Feb   [#13]
French version!
https://moiscript.weebly.com/addcornerspoints-polylignes.html


From: Moi3dFan
22 Feb   [#14] In reply to [#11]
Greetings!

I encountered a problem, when a polyline turns into a polycurve, the script doesn't work anymore

https://drive.google.com/file/d/1u2LwGowMSEeUYyLTR0SxRHH0jSVW0hO1/view?usp=sharing

Can this be solved?

Attachments:
MoI_Nr1YgXqf35.mp4


From: Michael Gibson
22 Feb   [#15] In reply to [#14]
Hi Moi3dFan,

re:
> I encountered a problem, when a polyline turns into a polycurve, the script doesn't work anymore

Yes, that's correct, the script is only designed to work on polylines which is what you requested.

Making it work on other types of input would need a pretty different process, it would not be a small change to the script.

I'm sorry I'm not able to do it at this time.

- Michael
From: Moi3dFan
22 Feb   [#16] In reply to [#15]
It's ok, I found a way out by just disconnecting the corners I want and applying the script to them.

I sorry for the distraction, I hope everything is going well with your work