Quantcast

How do I assemble .scad objects I have designed on to one screen

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How do I assemble .scad objects I have designed on to one screen

Kappelmeister
This post has NOT been accepted by the mailing list yet.
I have designed a number of separate parts and named each part as a module.  I have stored these files in a named data file.
What I want to do now is to call up the modules on my screen and assemble them.  I have so far failed to find any description of how this can be done that works. When I call up the module the console says "unknown module" and "No top level geometry to render"
What am I doing that is wrong.  It has to be something simple.    
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How do I assemble .scad objects I have designed on to one screen

jazzjohn
Did you "include" the file?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How do I assemble .scad objects I have designed on to one screen

MichaelAtOz
Administrator
In reply to this post by Kappelmeister
The OpenSCAD GUI editor contains OpenSCAD code. This is the main code that is executed when you preview or render. Usually this main program is saved as a .scad file.

As John said to access modules in another file you need to include <the_file>, then you can call the modules.

include<my_file.scad>
my_module(my-parameters);

Alternatively you can put the module calls & the code to 'assemble' them into the one file and open that with OpenSCAD.
 
Admin - PM me if you need anything,
or if I've done something stupid...

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work.
Obviously inclusion of works of previous authors is not included in the above.


The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How do I assemble .scad objects I have designed on to one screen

MichaelAtOz
Administrator
In reply to this post by Kappelmeister
p.s. Welcome to the forum. Your post is still flagged as "This post has NOT been accepted by the mailing list yet", so nobody gets it unless they look.
You need to subscribe to the mailing list, and CLICK THE LINK in the registration email.
Admin - PM me if you need anything,
or if I've done something stupid...

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work.
Obviously inclusion of works of previous authors is not included in the above.


The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How do I assemble .scad objects I have designed on to one screen

Kappelmeister
This post has NOT been accepted by the mailing list yet.
In reply to this post by Kappelmeister
Many thanks for your help. I have now managed to get two of my parts appearing on the screen.  The problem I have now is that they appear merged at the origin.  I need to 'translate 'them to move them apart.  If I precede "module name();"for each module with the usual 'translate' instruction, the module does not respond and remains rendered merged at the origin.
The Console gives a warning that "Object may not be a valid 2-manifold and may need repair"  
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How do I assemble .scad objects I have designed on to one screen

jazzjohn
Just translate each object as you call it. For example:

Include <myModuleFile.scad>

//will place at origin:
OneOfTheModules();

//will place elsewhere:
translate([100, 200, 100])
    OneOfTheModules();
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How do I assemble .scad objects I have designed on to one screen

Kappelmeister
This post has NOT been accepted by the mailing list yet.
In reply to this post by Kappelmeister
I am entering the following

include<E:\My Documents\Openscad Files\Jenny's Robot\MidSectionFront.scad>
translate([0,0,10])
MidSectionFront();

include<E:\My Documents\Openscad Files\Jenny's Robot\FrontPlate.scad>
FrontPlate();

The two sections are still rendered at the origin and I still get the same warning message in  the console.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How do I assemble .scad objects I have designed on to one screen

Doug Mcnutt
In reply to this post by jazzjohn
The suggestion is:

//will place at origin:
OneOfTheModules();

//will place elsewhere:
translate([100, 200, 100])
     OneOfTheModules();

My question is:

If I do something like that with multiple parts that have to fit
together and they use dimensions that have to match: Is there any way to
avoid the problem of the treatment of "variables" where one has to be
careful about defining them once and only once?

As of now I am defining what I would call globals and drawing the parts
in modules which are given dimensions as arguments using a bunch of what
I call subroutine calls and I have to fool with // pairs in front of the
parts I want to suppress. It's impossible to tell the boss, who wonders
why I ever use a keyboard, how to do that himself.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How do I assemble .scad objects I have designed on to one screen

jazzjohn
Please post the code in the included module file. You might be drawing the objects in the include file (at the origin) and your call to  the include file might not be doing anything.

Not sure what's going on, but seeing the code would make it easier for others to help you.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How do I assemble .scad objects I have designed on to one screen

Kappelmeister
Indeed both of my 'include' modules were created centered at the origin, but I don't understand why neither of them respond to the 'translate' command.

If it will help you help me then I will include the complete code but you might find it rather shabbily constructed.  I have not been using Scad for very long.  
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How do I assemble .scad objects I have designed on to one screen

ednisley
In reply to this post by Doug Mcnutt
On 03/15/2017 03:09 PM, doug wrote:
> I have to fool with // pairs in front of the parts I want to suppress

You can use if() statements to control what's generated. For example, I
set a Layout constant up near the top of the file:

Layout = "BuildFinCap";

Then, after defining all the modules & whatnot, near the bottom:

if (Layout == "BuildFinCap")
   translate([0,0,FinCapSize[LENGTH]])
     rotate([180,0,0])
       FinCap();

While creating the model, sometimes I need a cross-section:

Layout = "FinCap";
Section = true;

...

if (Layout == "FinCap") {
   if (Section) render(convexity=5)
     difference() {
       FinCap();
       translate([-FinCapSize[OD],0,FinCapSize[LENGTH]])
         cube([2*FinCapSize[OD],
               2*FinCapSize[OD],
               3*FinCapSize[LENGTH]],center=true);
     }
   else
     FinCap();
}

That requires figuring out what you want to do beforehand, then setting
up the code to make that happen, which is not entirely a Bad Thing. It
tends to remind me what I was thinking when I started writing the code,
anyhow. [grin]

--
Ed
http://softsolder.com

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
 --
Ed
softsolder.com
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How do I assemble .scad objects I have designed on to one screen

jazzjohn
In reply to this post by Kappelmeister


Here's a simple example. You can compare it to what you have.

MyIncludeFile.scad


callingProgram.scad

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How do I assemble .scad objects I have designed on to one screen

Doug Mcnutt
I donno about limits for attachments but:

Enclosed is a .scad from which I have removed a bunch of stuff that
isn't working -- yet.

The three parts of the code have comments about introducing // pairs to
be able to look inside.

It has been working for me and even includes a use command, commented
out, which I'm working on to merge the dimensions with much longer perl5
code that handles the circuit board and has to be altered so everything
fits in the end.

The only real problem is that other people, my boss and a machinist,
have a real problem understanding.

It would be nice to offer them Apple-style click and shove to see what
I'm doing. Perhaps my scheme will help the originator of this thread.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

dougNow.scad (29K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How do I assemble .scad objects I have designed on to one screen

Kappelmeister
In reply to this post by jazzjohn
BINGO!

When I named my module in the .scad file I wrote "module MidSectionFront();"   I noticed that in your example you did not put in the ";".
When I removed that from the .scad file, everything worked fine.

Many Thanks for your help. Problem solved!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How do I assemble .scad objects I have designed on to one screen

jon_bondy
Yeah.  One extra semi-colon can be pretty annoying (and difficult to
spot).  A syntax-oriented editor that could display the extent of a
statement could be helpful here.


On 3/15/2017 5:58 PM, Kappelmeister wrote:
> BINGO!
>
> When I named my module in the .scad file I wrote "module MidSectionFront();"
> I noticed that in your example you did not put in the ";".
> When I removed that from the .scad file, everything worked fine.
>
> Many Thanks for your help. Problem solved!
>


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Loading...