Script idea: create a bone between two coordinates

Moho allows users to write new tools and plugins. Discuss scripting ideas and problems here.

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
User avatar
moe33
Posts: 11
Joined: Mon Sep 23, 2019 4:56 am
Location: Beijing

Script idea: create a bone between two coordinates

Post by moe33 »

Hi everyone, I have a idea for a script: Get two position coordinates and create a bone between the two coordinates. A bit like DUIK.
I made a script by myself. I'm really sorry that I don't know how to write code at all. The script is made entirely by copy and paste...
This script can only get the coordinates of two points, and then create a bone.
Maybe the code looks messy, but luckily it can be used.
But I hope it can have more functions, such as getting the center coordinates of a shape or the center coordinates of a layer.
If you can, please help me improve this script...
Thank you very much!

https://drive.google.com/drive/folders/ ... sp=sharing
User avatar
gilcartunista
Posts: 55
Joined: Mon Mar 14, 2016 7:13 pm
Location: https://www.facebook.com/gil.cartunista
Contact:

Re: Script idea: create a bone between two coordinates

Post by gilcartunista »

Hi moe33...Thank you!!! I use Moho 11, and it works beautifully!!! Grateful!!! For your enormous generosity! Grateful!
User avatar
SimplSam
Posts: 1174
Joined: Thu Mar 13, 2014 5:09 pm
Location: London, UK
Contact:

Re: Script idea: create a bone between two coordinates

Post by SimplSam »

I know the Grid (View > Enable Grid) is not so good, but did you try using that to get your bones to snap?

I know we definitely need better Snapping support for all 'draw/transform' tools.
Moho 14.2 » Win 11 Pro 64GB » NVIDIA GTX 1080ti 11GB
Moho 14.1 » Mac mini 2012 8GB » macOS 10.15 Catalina
Tube: SimplSam


Sam
Daxel
Posts: 1080
Joined: Wed Mar 27, 2019 8:34 pm

Re: Script idea: create a bone between two coordinates

Post by Daxel »

Thanks for the script!
I use the "divide" feature on the select points tool frecuently to create a point in the middle of other two for things like these where I want something centered.
User avatar
moe33
Posts: 11
Joined: Mon Sep 23, 2019 4:56 am
Location: Beijing

Re: Script idea: create a bone between two coordinates

Post by moe33 »

SimplSam wrote: Thu Aug 05, 2021 8:11 pm I know the Grid (View > Enable Grid) is not so good, but did you try using that to get your bones to snap?

I know we definitely need better Snapping support for all 'draw/transform' tools.
Yes, I have tried to use the grid, but it is troublesome.
So I want to use a script to get the coordinates in order to accurately build the bones.
You can try to use my script, it can accurately build bones between two points.
Post Reply