Anim8or Community

Please login or register.

Login with username, password and session length
Advanced search  

News:

An update to Anim8or, v1.00b, is available with a few bug fixes. Get your copy HERE. See the "ReadMe" file for details.

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - freesailor

Pages: 1 [2]
16
ASL Scripts / Re: ASL Scripts Database
« on: October 15, 2010, 02:18:01 am »
3Dgeek11: yup! as i wrote, it took about 20 minutes(but I crashed anim8or twice, shoulda taken less time...lol), and I also have a walls script that i used for the dormer walls.....

After accessing the two scripts, I have decided to rewrite both, with much more comments, and I'll try to make them more understandable(sp? is that a word?) to the layman... the windows script is especially convoluted, a result of limited number of code instructions .

Kreator: i have written new code for soffits, but as i said, I have VERY limited access to buildings with that type of eave treatment.... so far, 3 options for the soffit/barge junction... if you could post pictures of samples, or direct me to a web site that has such samples, I'd appreciate it, as I could include more options now, rather then later...

aloha
freesailor

oops! almost forgot... I need textures for building exteriors... willing to  buy if I can get a large variety of textures.... does anybody know where i can find these??? tnx...

17
ASL Scripts / Re: ASL Scripts Database
« on: October 13, 2010, 06:23:58 am »
Kreator:
thanks for the advice... it would seem that I released these scripts a little prematurely, but I needed some encouragement to continue with their development... getting a little burned out with ASL... it hasn't got enough instructions to write really elegant code... needs user defined functions, or subroutines at least (Steve?!?). sooooo... if you change the code in roofs.a8s parameters from:   #parameter("16\"o.c. or 24\"o.c.", int, 0, 0, 0);
to:                      #parameter("Rafter Centers", int, 24, 0, 24);
and add this code at the end just before $roof:Close();:
Code: [Select]
if (parameter("Rafter Centers") == 0 && parameter("Gables %") <100)
{
$roof.OpenFace(0,4);                 /*          soffits                                */
$roof.VertexN($roof.AddPoint(($lx/2, $tail_height-$fascia+0.06944, $wz/2)));
$roof.VertexN($roof.AddPoint((-$lx/2, $tail_height-$fascia+0.06944, $wz/2)));
$roof.VertexN($roof.AddPoint((-$lx/2-$overhang, $tail_height-$fascia+0.06944, $wz/2+$overhang)));
$roof.VertexN($roof.AddPoint(($lx/2+$overhang, $tail_height-$fascia+0.06944, $wz/2+$overhang)));
$roof.CloseFace();
$roof.OpenFace(0,4);                 
$roof.VertexN($roof.AddPoint(($lx/2, $tail_height-$fascia+0.06944, $wz/2)));
$roof.VertexN($roof.AddPoint(($lx/2+$overhang, $tail_height-$fascia+0.06944, $wz/2+$overhang)));
$roof.VertexN($roof.AddPoint(($lx/2+$overhang, $tail_height-$fascia+0.06944, -$wz/2-$overhang)));
$roof.VertexN($roof.AddPoint(($lx/2, $tail_height-$fascia+0.06944, -$wz/2)));
$roof.CloseFace();
$roof.OpenFace(0,4);                 
$roof.VertexN($roof.AddPoint(($lx/2, $tail_height-$fascia+0.06944, -$wz/2)));
$roof.VertexN($roof.AddPoint(($lx/2+$overhang, $tail_height-$fascia+0.06944, -$wz/2-$overhang)));
$roof.VertexN($roof.AddPoint((-$lx/2-$overhang, $tail_height-$fascia+0.06944, -$wz/2-$overhang)));
$roof.VertexN($roof.AddPoint((-$lx/2, $tail_height-$fascia+0.06944, -$wz/2)));
$roof.CloseFace();
$roof.OpenFace(0,4);                 
$roof.VertexN($roof.AddPoint((-$lx/2, $tail_height-$fascia+0.06944, $wz/2)));
$roof.VertexN($roof.AddPoint((-$lx/2, $tail_height-$fascia+0.06944, -$wz/2)));
$roof.VertexN($roof.AddPoint((-$lx/2-$overhang, $tail_height-$fascia+0.06944, -$wz/2-$overhang)));
$roof.VertexN($roof.AddPoint((-$lx/2-$overhang, $tail_height-$fascia+0.06944, $wz/2+$overhang)));
$roof.CloseFace();
}
it will add soffits on roofs with hips if #parameter("Rafter Centers", int, 24, 0, 24); is zero.
I also added code to make adjustable barge rafters( I assume you mean the gable overhang here), but ran into a little problem with the code and am still considering ways to correct it.
One problem I have with soffits and such is that I live in Hawaii, and this type of construction is rare(only multi_million mansions have soffits...lol), so I have very little experience with their actual layout... I have built some houses with soffits, but they had str8 gable roofs with no overhang... not sure how to construct the junction of gable overhang and soffit... pictures would be of great help... I believe that UK construction practices a lot of this type of stuff...

windows.a8s: the only parameter that doesn't work is "Double Hung", I'm still pondering that one....
but the stiles and mulliens size can be changed... the point2 array $dim holds a variety of sizes for the window.. guess I shoulda commented that one a little better... anyway $dim[2].x & $dim[2].y hold the sizes of the stiles and mulliens... default is 5/4... all the sizes in $dim[] are commented, so you can change them if you want, although I'm trying to make all these scripts produce structurally correct drawings, so adjusting the sizes should be done with that in mind.... i.e. if your wall happens to be built of 2x6's it shouldn't be necessary to change the stile size to keep everything proportional(I think?!?) It would be nice if there were more parameters available, then i could include all dimensions there.
Anyway, your interest encourages me to continue with these scripts, thank you for the words of advice, and i will post any major changes to either script as I make them.

Oh, and for Neirao: It wasn' my intention to make a script that would create any roof possible, this would be difficult if not impossible... what I trying to provide is a tool with which one can use to create a variety of basic roofs quickly... attached is an example of one that took me about 20 minutes(how does one put images in the body of a post, anyway?????Grrr)

aloha
freesailor

18
ASL Scripts / Re: ASL Scripts Database
« on: October 11, 2010, 07:13:33 am »
hmmmm, tnx to both of you for taking the time to check it out..........
first for Neirao... I'm not exactly sure if you mean things like dormers and such... you could build these with the same script and another mesh to form the walls.... but maybe I'll try to use some attributes to do it automatically, if thats possible.

and Kreator, those disabled params are for rafter tail centers and extra was for removing the ceiling, but I wasn't happy with the way the rafters worked out, so I removed them... then I wrote another script that draws just the framing for the roof to work out how to add the rafters to the first script... will update roofs.an8 soon and repost it if you're wanting to use it for whatever... if you are into drawing houses, you might like my windows script, its got some pretty cool features like variable number of stiles and mulliens, etc... and you can combine two or more windows to make fairly intricate compound windows... let me know
aloha
freesailor

19
ASL Scripts / Re: ASL Scripts Database
« on: October 10, 2010, 03:57:47 am »
so here's a script for a roof:
1. it can draw a hip roof, or a gable roof, or a dutch gable roof.
2. pitch, fascia, and barge rafter sizes are parameters, along with length and width.
3. dutch gables can be placed anywhere between the building wall and the roof peak.
4. I also have written a program that will make a script from a model... in perl.. if anyone would like it, let me know..
it only works if the model is a single mesh, and doesn't keep the texcoords, either(was getting a little burned out on it:)),
but it will work on fairly complicated meshes (I tried it on a mesh with 125,000 faces...heh... took a while but copied the model perfectly.)

20
ASL Scripts / Re: setting materials in ASL
« on: September 25, 2010, 03:12:34 am »
hmmm... guess that perl script wasn't an allowed type...oops!!!
here's the script... it isn't quite finished, I got hung up on that materials thing and kinda burned out on writing scripts... but it just needs barge rafters and texcoords... 'cept seeing as you can't set two materials, I'm thinking of just not including the coords, cause you'll just add them when you set the roof texture anyway.......
What I'm trying to do is create plug-ins that enable you to draw a structurally correct house from a blueprint...
and then use it in a 3d program so you can wander through the house....
so here's the roof script....

21
ASL Scripts / Re: setting materials in ASL
« on: September 24, 2010, 08:47:09 pm »
hmmmm... tnx for the post....
after studying the problem some more and trying a couple other approaches, I came to the basically the same conclusion... parametrics won't accept two materials....Grrrr...
AddMaterial only produced an out of bounds memory error when I tried that...
Oh well, guess I'll have to apply the other materials after converting to mesh, not really that much of a problem for me, but if other people use my scripts, it may cause some unpredictable behavior with the face normals...
by the way, is there any other way to post scripts if you don't have a website? You might like to try my roof script, it is quite handy, it can draw a roof with full hips, full gables, or dutch gables at any position between the wall and roof peak...
I call it dial-a-gable...lol
aloha

oops, never mind, i just found the insert code  button...lol

22
ASL Scripts / Re: setting materials in ASL
« on: September 22, 2010, 08:49:16 pm »
tnx for the quick reply... i guess i wasn't very clear about my problem... i can define my materials OK( they both show on the materials button ), but  only one material is applied to the parametric... let me give an example:

$window.Open();
$window.SetMaterial(0, $mat0);
$window.OpenFace(0,4);
/* draw window frame */
...
...
$window.CloseFace();

$window.SetMaterial(1, $mat1);
$window.OpenFace(1,4);
/* draw glass pane */
...
...
$window.CloseFace();
$window.Close();

for reasons I can't solve, this doesn't work!?! the resulting parametric has only material zero applied, even to the glass...and the saved model shows no face with material index 1...unless I manually apply it... any ideas...anyone??
by the way, I downloaded your f8ce script, VERY nice piece of work BOB_I_Ts, then I ran my m2s script on a model... ended up with over 31,000 points, over 31,000 faces, and over 125,000 vertices, and script that was over 25,000 lines of code... took about 10 to 15 seconds to execute, but drew a exact match of the original, so I guess my model2script WILL work on complex models...lol
aloha and thanks again...

23
ASL Scripts / setting materials in ASL
« on: September 21, 2010, 10:36:07 pm »
hello all....
I'm a noob to anim8or and ASL... been playing with anim8or for a couple of months and decided i could use some plug-ins for my models of houses, specifically the windows. I have tried ever possible permutation of SetMaterial to try and set the window frame to one material and the glass to another, none of which works... sooooo... is this possible with a script??? the docs say I should be able to do this, but as I said, I'm sure I've tried every combination of instructions with no luck.... the resulting model .an8 file shows only face 4 4 0 -1(trim) (no face 4 4 1 -1(glass)).. could sure use some help with this, as most of my plug-ins will need to have at least two materials.
    I've read most of the posts and find no subjects addressing this problem,(maybe i'm just too stoopid to realize my mistake...lol), but at the same time I saw a lot of requests for a script hat would make an ASL plug-in from a model, so I wrote this little gem which will do just that for most simple! models...its works fine on my windows(some have over a thousand faces!!!). I'm not sure if it is allowed to post  a perl script on this board, but I have no website to post it to.... so here it is:
                                                       Model2script.pl (m2s.pl)

#!/perl/bin/perl
##### Windows perl = http://www.activestate.com/activeperl/downloads ActivePerl-5.8.8.822-MSWin32-x86-280952.msi... free!!!!
##### a little script that extracts the points and faces from an anim8or model.an8 file
##### then uses them to write them to write an .a8s script...
##### command line = c:\>m2s.pl model-name.an8... this program expects the model to be in C:/anim8or/projects
##### output =  c:/anim8or/scripts/model-name.a8s
##### notes: 1. output is formatted for Notepad... arial/regular 12 pt...
#####        2. this will only extract the first mesh of a model... so <join solids> and <convert to mesh> the model first....
#####        3. you will have to apply texcoords to the generated model yourself... it was becoming too much of a chore as it was...
#####        4. the plug-in will show as the default electric plug... you'll have figure out the bit map button yerself... lol
#####        5. the newly generated parametric is NOT editable, even if you convert it to a mesh...if you need to edit the new model,
#####           save it first, reopen he saved model and then you can do any editing.....
#####           I haven't really figured out how the meshes are drawn orignally, so the script creates double points for some faces...
#####           but saving it will remove the extra points and then all is well.... rick... FIXED!!!...sorta... lol
use strict;
use warnings;
our ($s, $ps, $x, $fp, $file, $i, $f, @pts, $p, $l, $fs, $ts, $ii, $pc, $sx);
our $spaces = " "x50;
$file = shift;     
open IN, "<C:/anim8or/projects/$file"; print "Working with $file\n";
while (<IN>)
{
   if ($_ eq "    points {\n")
   {
   while ( <IN> )
      {
      if ( $_ eq "    }\n" ){goto faces;} # can't modify $_ ... and a little lesson in regex ... lol
      $s = $_;                                  # $s = "            (x.xxxxx x.xxxxx x.xxxxx) (x.xxxxx x.xxxxx x.xxxxx) "   ...etc.
      $s =~ s/^\s+//;                         #       ^^^^^^                                                     remove these leading spaces...
      $s =~ s/\s{1}/\,/g;                   #                     ^       ^        ^        ^       ^        ^ substitute "," for " "
      $s =~ s/\),/\)\; /g;                   #                                                                ^ substitute "); " for "),"
      $s =~ s/\s\,$/ /;                      #                                                                ^ substitute " " for trailing " ,"
      $ps .= $s;                               # append the line to a new string      
      }
   }
faces:
if ($_ eq "    faces {\n")
   {
   $i = 0; $ts=""; $ii = 0;
   while ($s = <IN>)
      {
      if ( $s eq "    }\n" ){goto done;} 
      $s =~ s/^\s+//;
      if ( $s !~ /\)\s\)$|\)\s\)\s$/ )
         {
         $sx = <IN>; $sx=~ s/^\s+//;
         $s .= $sx;
         $s =~ s/\)\(/) (/;
         }
      $s =~ s/(\d+)\s(\d+)//;
      $fs .= "\$faces\[$ii\] = ($1, $2); ". substr ($spaces, 0, 20-(17+(length($1)+length($2)-length($ii))));
      $ii++; if ( $ii%6 == 0 ){$fs .= "\n";}
          $s =~ s/(\s\d*\s)(\-\d*\s\(\s)//;
      while ( length($s) > 3 )
         {
         $s =~ s/\((\d*)\s\d*\)\s//;
         $s =~ s/\((\d*)\)\s//;
         $ts .= "\$q[$i] = $1; ". substr ($spaces, 0, 20-(14+length($1)+length($i)));
         $i++; if ( $i%10 == 0 ){$ts .= "\n";}
         }
      }
   }
}
done: close IN;                                     # if you want more then one plug-in generated by this script, you'll need to change         
                                                    # \$basic to something else(\$basic2 comes to mind...lol)all thru this script...
$fp = "/*$spaces m2s.pl generated script for: $file. By: Freesailor Raceware */\n
/* Define Directives */
\#plugin(\"object\", \"mesh\", \"Basic\")\;
\#return(\$basic)\;

/* Declare Variables */
shape \$basic;
int \$i, \$x, \$pc, \$q[$i];\n";                   
@pts = split (" ", $ps);                            # split string into an array...
$x = scalar(@pts)-1; $f = $x+1; $l = 0;             # $x = numer of array elements...
$fp.= "point3 \$p[$f];
point2 \$faces[$ii];\n
/* Make Assignments */\n";
for $i ( 0..$x )                                    # get largest array element length...
   {
   if ( length( $pts[$i] ) > $l )
      {
      $l = length( $pts[$i] )
      }
    }
$l = $l+11; $f = 0;                                 # this works up to array element 999... if array is larger change 11 to 12...
for $i ( 0..$x )
   {
   $p = "\$p\[$i\] = $pts[$i] ";               # here we format the output to print the correct asl assignment instruction...               
                                                    # if you modify for all meshes..
   $p .= substr ($spaces, 0, $l-length($p));   # make it look pretty...
   $fp.= $p;                                   # append to final print line...
   $f++; if ($f == 4) { $fp .= "\n"; $f = 0; } # $f = number of point3 arrays per line...
   }
$fp .= "\n$fs\n\n$ts\n";                                # add our face and face vertex index arrays to the print line...then the code to execute...
$fp .= "
/* Draw Parametric */
\$pc = 0;
\$basic.Open();
for \$i = 0 to \$p.size-1 do
   {
   \$basic.AddPoint(\$p[\$i]);
   }
   for \$i = 0 to \$faces.size-1 do
      {
      \$basic.OpenFace(0,4);
      for \$x = \$pc to \$pc+(\$faces[\$i].x-1) do
          {
         \$basic.VertexN(\$q[\$x]);
         }
      \$basic.CloseFace();
      \$pc = \$pc+\$faces[\$i].x;
      }
\$basic.Close();
\n";
$fp .= "/*$spaces script for $file$spaces */";
print "\n$fp\n";
$file =~ s/.an8/.a8s/;
open OUT, ">C:/anim8or/scripts/$file";
print OUT "$fp\n";
close OUT;
exit;
hmmmm.. comments didn't copy so well, but you get the idea...lol
as the script comments, it does have some flaws, but will create a .a8s script that duplicates your model(simple ones please!!!)
aloha
freesailor



Pages: 1 [2]