The CNC module

The CNC module provides methods that let you generate CNC download files using parametrics. Four methods are provided so that you can output member or material CNC files with or without setup. The 1st argument for all four methods takes a list [of members or materials, depending on the method]. If the list in the first argument is empty, running the parametric opens a selection dialog. The 2nd argument takes a string that is a path. The two DownLoad...WithSetup methods take a 3rd argument , which takes the CNC.Setup() method for specifying the " CNC configuration ." DownloadMembersWithSetup() shown in the example below is one of the four methods. Click here for help on all four methods.

DownloadMembersWithSetup( arg1 , arg2 , arg3 )

arg1 takes a list of member piecemarks.

arg2 takes a string that designates a path to a folder.

arg3 takes a CNC setup configuration designated inside the () of the CNC.Setup() method. No entry inside the () of CNC.Setup() returns the currently selected " CNC configuration ."

Here's some parametric scripts that use the CNC module :

# Downloads member 'B_1' using default cnc setup to folder 'cnc_output'

import CNC
CNC.DownloadMembersWithSetup(['B_1'], 'cnc_output', CNC.Setup())


# Downloads members 1B1& 23C, materials a1 & a2 & w3 & w4

from CNC import CNCMaterial
from CNC import CNCMember
import os

mt_list = [ "a1", "a2", "w3", "w4" ]
mem_list = ["1B1", "2C3" ]
mtrl_path = os.path.join("./output", 'CNC_material' )
mem_path = os.path.join("./output", 'CNC_member' )


# Downloads members 1B1& 23C, materials a1 & a2 & w3 & w4

from CNC import CNCMaterial
from CNC import CNCMember
import os

mt_list = [ "a1", "a2", "w3", "w4" ]
mem_list = ["1B1", "2C3" ]
mtrl_path = os.path.join("./output", 'CNC_material' )
mem_path = os.path.join("./output", 'CNC_member' )

if os.path.isdir(mtrl_path) == False:
    os.mkdir(mtrl_path)

if os.path.isdir(mem_path) == False:
    os.mkdir(mem_path)

CNCMaterial( mt_list, mtrl_path )
CNCMember( mem_list, mem_path )

## If you pass an empty list to either method you will get the
## selection dialog

CNCMaterial( [], "")


To get help on the CNC module , you can use the SDS2 Python Prompt and the built-in Python functions dir() and help() :

SDS2 Python Prompt

>>> import CNC                                            # import the module
>>>
>>> dir(CNC)                                                 # do a dir() on the module name
['CNCMaterial', 'CNCMember', 'DownloadMaterialsWithSetup', 'DownloadMembersWithSetup', 'GetSetups', 'Setup', '__doc__', '__name__', '__package__']
>>>
>>> from CNC import *                                 # import functions from the module
>>>
>>> help(CNCMaterial)                                 # help on CNCMaterial
Help on built-in function CNCMaterial:

CNCMaterial(...)
C++ signature:
CNCMaterial(boost::python::list, std::string) -> void*

>>> help(CNCMember)                                  # help on CNCMember
Help on built-in function CNCMember:

CNCMember(...)
C++ signature:
CNCMember(boost::python::list, std::string) -> void*

>>> help(DownloadMaterialsWithSetup)        # help
Help on built-in function DownloadMaterialsWithSetup:

DownloadMaterialsWithSetup(...)
Example: DownloadMaterialsWithSetup( [mark1,mark2], "downloadpath", Setup() )
C++ signature:
DownloadMaterialsWithSetup(boost::python::list material_marks, std::string path, CNC::Setup setup) -> void*

>>> help(DownloadMembersWithSetup)         # help
Help on built-in function DownloadMembersWithSetup:

DownloadMembersWithSetup(...)
Example: DownloadMembersWithSetup( [mark1,mark2], "downloadpath", Setup() )
C++ signature:
DownloadMembersWithSetup(boost::python::list member_marks, std::string path, CNC::Setup setup) -> void*