Jump to content


Photo

What to learn?


  • Please log in to reply
5 replies to this topic

#1 setz

setz

    Advanced Member

  • Members
  • PipPipPip
  • 333 posts

Posted 06 March 2017 - 02:50 PM

I want to write a quantize script for facetted objects.  When group of objects is selected and the script is fired it will highlight points on the objects whose coordinates do not match an increment typed into an input field.  There will be an option to then apply a given quantized amount to all those points.  I will use it to help clean up imported garbage.  I may even add live sliders for global or independent XYZ quantize values.

 

What should I begin to learn, and can you recommend a good beginners resource?  It's been awhile since I have done any programming; back in the days of fortran, pascal and basic... even a little punchcard experience, lol.



#2 Chris lund

Chris lund

    Advanced Member

  • Members
  • PipPipPip
  • 518 posts
  • LocationWestcliffe Colorado

Posted 06 March 2017 - 03:58 PM

You could get the old SDK, presuming the calls will be if not the same, at least organized similarly.  Can't guarantee that though.

 

Probably the best part is to lear how to walk through an object point by point or segment by segment.  The old SDK walks you through that as an example.

Of course, you will need to learn the syntax of Python and apply it to the logic of what the old SDK uses instead of the FSL/C Syntax.

 

The for and or the While loops are important for walking through an objects geometry.

 

For the most part, all the API's are documented in a logical order to help you dig out the API calls you need.

There are a ton of them, so working out the logic in how they are organized it very important.

for example, you will probably be needing to retrieve each segment length and compare it to your input field variable.  (old system the FUIM is the interface APIs)

knowing that you can find a call for measuring the segment length in a model by organization

X.X AIP Reference: Project: Modeling: Objects   to find   ::   fz_objt_alys_get_segt_length

 

 

Learn the different types of scripts and determine which you will want  to use.   In this case, probably a tool, or a utility script with a dialog.

Learn the DataTypes fZ has extended the standard types.

Do you remember parameters and pointers?

 

When the preview comes out, hopefully they will have some ready examples.  As the easiest way to do something is to modify an existing script that has all the general features that you want.

 

cheers!

 

 

 


Christopher Lund

Neurascenic - Industrial Design


#3 setz

setz

    Advanced Member

  • Members
  • PipPipPip
  • 333 posts

Posted 06 March 2017 - 04:25 PM

Thanks Chris!  I still have your Attention Script in my folder hoping one day it will be reanimated.

 

How is scripting actually done?  Is it like creating a text file and then compiling it with the SDK or was the SDK an actual interface for writing, syntax checking and testing?

 

Do you think there will be much overlap between the old SDK and a new Python based one?  I don't really understand why some of the old scripts stopped working and wonder how much effort learning the previous system will help with the new.

 

I am looking forward to seeing some examples to dissect.

 

 



#4 Chris lund

Chris lund

    Advanced Member

  • Members
  • PipPipPip
  • 518 posts
  • LocationWestcliffe Colorado

Posted 07 March 2017 - 02:44 AM

The attention script will be my first, again.  ADS has kind of implemented some of the functionality, but not completely.

 

In the past, it was it's own Z environment where you wrote it and compiled it.   You could have written it outside however, and just brought it in at compile time.  Would be useful if you have a preferred text editor.

with the Advent of Python, not sure how this is going to go.   As the API calls are ostensibly going to be "includes" into the OS's Python environment.  This being the case, it may very well be better to use a dedicated editor.  There are Many.  I have PyCharm, though have anxiously been awaiting to use it.

 

The actual overlap is hard to say.  I would bet that the overall organization will be similar, but they may have re-written the specific API calls.  Since they probably had to do so any way. As well, as much of the app is different than 6.x or 5.x when scripting was first available.  The logic of walking through the geometry of an object, or group (these are different) is probably the same though.

 

Since, Z's behavior with the pick tool is quite a bit different than in the past, this is probably different in the SDK too.  There seems to be far less pre-picking  than in the past.

Callbacks, good chance a number of these are different (callbacks are essentially how the formZ app hooks into and uses your script)

For the most part though, if the tool is legacy from 6.x or 7.x  then don't expect the API's for that tool to be there either.  (Think C-Mesh tool)

 

If I understand correctly, the SDK got broken when they went to a fully 64Bit environment, as did the legacy file formats.  By this time, they probably already had it in their head that they were making the move to python and did not see a valuable reason to put in the effort that was going to be abandoned soon enough any way.  (speculation)

 

 

litte extra info:

Do understand, however, that not everything is really doable in scripting.  In the old version, you could create a new object type with the full SDK, but not with the scripting environment.

Too, importers and exporters, and customer render modes were off limits to scripting.    Shaders, on the other hand, were available.

 

Welcome to the endeavor!  you will find it entertaining, frustrating, and ultimately rewarding!

 

cheers!

 

¢£


Christopher Lund

Neurascenic - Industrial Design


#5 Chris lund

Chris lund

    Advanced Member

  • Members
  • PipPipPip
  • 518 posts
  • LocationWestcliffe Colorado

Posted 07 March 2017 - 03:04 AM

Just took a closer look at the two examples that they provided, the API calls are going to be totally different.

 

Added to that, Python is object oriented, and the examples appear to be so as well.   FSL, was not.  So, we will be calling objects (not the same as in fZ)  that have methods built into them, rather than calling functions that get access to data willy nilly.

 

Apologies if I am insulting your intelligence here, but just in case...   an object is like the old data structure, but has added to it, methods (functions) built right into it that work on the data of that object.

Pretty slick really, but it is a different way of thinking.  I don't recall if you can have the functions separate of an object or not.  been a minute! 

 

Will be interesting!

 

¢£


Christopher Lund

Neurascenic - Industrial Design


#6 Chris lund

Chris lund

    Advanced Member

  • Members
  • PipPipPip
  • 518 posts
  • LocationWestcliffe Colorado

Posted 08 March 2017 - 05:57 PM

Setz,

 

PyCharm has a version called PyCharm Edu for the purpose of learning Python.

 

One caveat, you will be learning they PyCharm IDE as well.  Which, I presume is why the EDU version is free, get you hooked  ;)

 

cheers!

 

 

¢£


Christopher Lund

Neurascenic - Industrial Design





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users