Jump to content
AutoDesSys Forums
Chris lund

Match 0.2 alpha Python Script WIP

Recommended Posts

Hello all,

My first attempt at a fZ/python script.  (this is an Alpha and has known issues.  ToDo List at the bottom of this message.)  File attached. 

What is Match? 

Match will scale objects to match the Boundary Length (not yet functional), Area, or Volume.  Not the bounding dimensions. Either Source/Master objects or a direct value in the UI can be used to determine the Target object sizes.  Scaling is also allowed. Such as 1.5 x  or .3333 of the Master.

Match, is shape/form agnostic.  That is, it doesn't care what the Target, nor Master shapes are, it will work as long as they have the topology you are trying to Match.   i.e.  a open poly line does not have a volume, so the script will not work if attempted. (currently, if an error is raised, nothing happens, including no indication of the error)

A surface objects area could be matched to the surface of a Solid, if you have a reason to do that, and visa versa.  Likewise a surface objects length can be matched to a open or closed line form and visa versa.

 

Hope this is useful for someone besides myself.

 

---------------------------

To use:  (if the .pyc file doesn't work on a PC, let me know, I will provide the source if need be)

Manually Install the script in the scripts folder (as far as I can tell, this cannot be in a sub-folder)

Abstract case:  Select the objects.   Currently, Last object created will act as the Master/Source.  All other objects selected will act as Targets. (This will be fixed in the future)    So, cut and paste the object you want to be the master, so that fZ regards it as the last object in the modeling buffer.  This will be fixed in the future.

Here are three arbitrary objects all with differing Volumes.  The Pyramidal shape will be the Master, as it is the last object created.

291607499_ScreenShot2020-02-20at5_00_11PM.png.5464091eb46da540eb3f846c1de79ef7.png

 

Master.                                                              Target                                                                 Target

1470887072_ScreenShot2020-02-20at4_56_22PM.png.72b9527b2e709183584c8a8ff9c81602.png332518278_ScreenShot2020-02-20at4_55_54PM.png.c029246d54039326c47e05c512c5876b.png 1668623723_ScreenShot2020-02-20at4_59_19PM.png.afc5277e6f21e77cc9344e6ba4e260e1.png

1. Select the objects you want to transform as well as the Master.

2. Chose, Extension/Run Utility, Navigate to the Match.pyc script.

the following dialog should appear.

1582995254_ScreenShot2020-02-20at4_49_47PM.png.3d1b12dad1d653a06de337667368c12a.png

Select your options,

In, this case, I am going to match the Volume Topology of the Pyramidal shape, with no scaling.

Click the OK button, Now the objects all have the same Volumes.

859772861_ScreenShot2020-02-20at5_19_30PM.png.0475952fd795380d3fee567e491e0a0a.png

Note 1: the surface areas are all different, while the Volumes all "Match"

1943518329_ScreenShot2020-02-20at5_20_32PM.png.8f9d7e2bb0a4bf1ea7b70d9da70e5f8c.png313420856_ScreenShot2020-02-20at5_20_53PM.png.e10f348a72bb8e5085f7091107ad17b3.png1022827987_ScreenShot2020-02-20at5_21_08PM.png.2380fd8ac3705611fcaedde164771e8a.png

 

TODO List.  (I will need the API Documentation to finish)

• Change UI to make sense.    The order of the UI is a little awkward right now.

• User configurable Units (currently only Imperial Units work and in Feet Only)  (really only matters when inputing size manually into the UI.  If matching to an existing volume, works as expected)

• Use Pick Order (currently, the last object created is the Master that all other objects picked gets matched to)  (Allow User to have first picked or Last Picked to be the Master by UI Choice)

• Minor issue with the Volume, does not always make a perfect match.  is sometimes off by a few thousands. (I do know how to fix it... just need to jump on it)

• Undo doesn't work, Not sure if that is my problem or something

• Clean up and Document Code

 

The script was built from what I could glean from the examples provided by ADS.  Realistically, this is a simple project, however it does hint at the power of what can be done.

The future is bright!

 

Next, I will show some examples of Why you would want to use it.

Screen Shot 2020-02-20 at 4.51.05 PM.png

Match.pyc

Share this post


Link to post
Share on other sites

Example Usage 1.

Intake/Exhaust using Cross sections to generate final object.  

Here is the final object.

1741965575_ScreenShot2020-02-20at6_47_49PM.thumb.png.05d4e236fd82b1e106e36cfc7dd74d8c.png

This object has the same cross section throughout, regardless of the cross section shape. Except the final rectangle, it is reduced 75% of the intake (cropped circle).

The Following is how I built it using the Match Script.

First I created the rough source shapes, with no regard to their areas, and placed them roughly where I wanted them.   There are 3 circles in the center, to help the loft tool maintain the desired cross section (can get a little wonky when changing shape types. it will bulge if only 2 circles are used.)

2044650637_ScreenShot2020-02-20at6_39_40PM.png.66184a52147237e190443bbdbb6a89c6.png

Making sure the master shape is the last one created, I cut and paste one of the intake shapes (again, the cropped circle)

Select all the objects I want to scale to the same area as the intake (all except the last of exhaust rectangles, I am saving that for another operation)

Launch the script from the Extensions/Run Utility Menu

Select Topology/surface. scale 1.0

816126021_ScreenShot2020-02-20at6_41_15PM.png.8fe915aefaa5eeb29a794b4c81749fc4.png

Click OK.

Areas of the 6 objects now match the intake.

 

I repeat the process again, but this time only select the intake cross (it is still the last object created) section and the final exhaust port cross section.

Run the script again and change the following settings:  Topology/Surface.   and Scale to .75

8226196_ScreenShot2020-02-20at7_06_03PM.png.c4333ee71a189b1236bc4aa511954f60.png

Click OK.

186306719_ScreenShot2020-02-20at6_41_38PM.png.22966634fc54bd434c91555e3f7ff91b.png

Select the cross sections in order and apply the loft tool.

1933176085_ScreenShot2020-02-20at6_47_49PM.thumb.png.66af0e86084fd49aa3408ae75c8f160a.png

 

more advanced examples.

400814327_MatchExample1-Area.thumb.jpg.58d4339ac767199c6a9d131cab3f7640.jpg

 

Share this post


Link to post
Share on other sites

Example 2, without directions, as hopefully, it is now clear what the script is for.

 

Here is a real world example. of matching a volume to a pre-specified volume via the UI.

Was given the requirement that the balloon have a specific Volume.  Enough to carry the weight of the basket, passengers, and the balloon itself.   But not so big, that it became cost prohibitive to build.   The actual volume was provided.   (I used the same math to figure this out, as the script did not exist 15 years ago, but planted the seed for the script)

 

1009352601_TweetyandSylvester.jpeg.442c9772462c88a627e2ee6a5c00776f.jpeg255068155_ScreenShot2020-02-20at7_21_01PM.png.6572502af524fc6ed3f57e3796da54bc.png

 

Other Balloons for the same client, only Sylvester got built, albeit pupils in the wrong spot, and he decided not to put the tongue on.

1840954493_ScreenShot2020-01-14at6_16_39PM.thumb.png.84e3219497175710895f823a68301343.png

 

 

 

 

 

Share this post


Link to post
Share on other sites

Thank you very much!  Just thought I would give a little teaser on what is possible with a need and the will to solve that need. Considering this was done without the documentation, I am hoping it will highlight the accessibility that the new API offers.  Once the documentation is available...  to be cliche, the sky is the limit!

I am truly excited to have scripting back!  I fundamentally believe that it will allow the real brains to focus on the platform and allows us users to make tools that are more niche in nature, such as this.  Looking at it realistically, tools like this probably aren’t in wide enough need for you to bother with.  On the other hand, those of us who do, will save a lot of time and improve the work!

Thank you for your hard work!  It will be worth it and worth the wait for me!   

Have sooooo many questions!  
 

cheers!

 

€hris £und 

Share this post


Link to post
Share on other sites

Hi Chris, that is just great, I enjoyed reading your report. Maybe I'll have a use for this! I totally enjoyed seeing the balloon itself. Your work is the most unique out there, due to the inflatable nature of them. Can you sometime post more of the stuff you did because that has to be some of the coolest form.Z made work out there. I can't image folks hanging off the bottom of something I created...

The script is great too, tho. Good idea for a script.

Share this post


Link to post
Share on other sites

Jaakko, John Alexander,

Thank you very much! More scripts to come, And I do plan on ultimately converting them to plug-ins.  Scripting is easier though.

John, That is pretty much the extent of my Hot Air Balloon Designs.  There are two others, but I do not have photos of them.  One of those, I merely augmented an existing balloon.  They are all Home builds, so they are classified as Experimental Aircraft.   I am not a licensed aeronautical engineer, so am not legally allowed to design them.  Home builds/experimental is the loophole. 

All the other designs are what are classified as cold air or forced air inflatables.  Primarily for advertising purposes.  Always considered myself a low grade industrial designer.  Dan Manoim (sp)  is the goto Guy for fZ industrial design.   He pops in now and again (I think, DanM?)  I have done other work, but mostly as the last guy on the list, so, clients never knew of me.   Don't know if I am allowed to show any of that work.  Some of that was, Denver International airport. (Flight Information Displays), Concepts for Arm and Hammer, Evian, Prototype This TV show (Personal Air Bag Safety device) Sadly only lasted 1 season, Intact Labs (project for NASA), JRF Visuals only, Evian water bottle, Hunter Douglas, Corona and some others.

Most of the things on that list never amounted to anything.   the FIDs got built, and the Prototype this got built.  My anonymous claim to fame.

here is some of the CABallon work, however.  (I no longer do this work, company was purchased, and the new company moved all design and production to South America)

Thanks for the interest!

The Dragon was probably one of the funnest projects, as I got to do the electronics and write the code for it too.

And, Yes FormZ was crucial in each of these projects.

 

2084971347_EXDOEventCenterDragonHead-28459.thumb.jpg.39d102da425d719b754e929003dcf268.jpgDSCF3592.jpg.79c5874fdf9636033321278b9984b95f.jpg 

Me tweaking some of the Micro-controller code

Video of the Dragon: http://www.neurascenic.com/Dragon2.m4v

 

Tommy-Mohawk-Inflatable-Character.jpg.864973a5d9282d27e7d4602adda96b8e.jpgFuzzy-Santa-Bear-Overalls-Inflatable-Character.jpg.cbad6f3286f6b81be7be18a28af944c3.jpgFuzzy-Dish-Kangaroo-Hopper-Inflatable.jpg.a80ae5403d3c8bda3a0c458a072b0998.jpgBulldog-Inflatable-Mascot.jpg.4012556af2a259d79ebc04ba21f1f94f.jpgSponge-Bob-Inflatable-Booth.jpg.78831cf898d5a8caf19d53277b07eda6.jpgColorado-University-Buffalo-Go-CU-Buffs-Forever-Buffs-Alumni-Furry-Inflatable-Mascot.jpg.bb1e640ffa6032b9cb318919933d737a.jpgPookaroo.jpg.58e4b91bf9113e0169b7a2bf8437663b.jpg1960024608_CaptainMorgan.thumb.jpg.30a7bbca7d34db12f0764178ce8f1e72.jpg

EXDO Event Center Dragon Head - 28459.jpg

Edited by Chris lund

Share this post


Link to post
Share on other sites

So, just found out that the .pyc file format is not cross platform.  I will update the script to a 1.0 and release it as source.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×