Changeset 1024 in main


Ignore:
Timestamp:
04/24/12 11:29:24 (7 years ago)
Author:
agalech
Message:

adding Documentation to Document3D

Location:
trunk/openPLM/document3D
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/openPLM/document3D/STP_converter_WebGL.py

    r1022 r1024  
    2222from OCC import XCAFApp, TDocStd , XCAFDoc 
    2323from OCC.TCollection import TCollection_ExtendedString , TCollection_AsciiString 
    24 from OCC.TDF import TDF_LabelSequence , TDF_Tool , TDF_Label 
     24from OCC.TDF import TDF_LabelSequence , TDF_Tool , TDF_Label  
    2525from OCC.Utils.Topology import Topo 
    2626from OCC.TDataStd import Handle_TDataStd_Name ,TDataStd_Name_GetID 
     
    4949 
    5050    """ 
    51     Class capable of generating from a file .step:  
    52      
     51     
     52    :param file_path: Path of the file **.stp** to analyzing 
     53    :param id: For the generation of the :class:`.Product`, **id** is assigned like product.doc_id for every node of :class:`.Product`. For the generation of the files of geometry **.geo**, **id** , together with an index generated by the class, is used for identify the content of every file 
     54     
     55     
     56 
     57    Generates from a path of :class:`~django.core.files.File` **.stp**:  
     58     
     59       
    5360    -A set of files **.geo** that represents the geometry of the different simple products that are useful to realize the visualization 3D across the web browser.  
    5461     
    55     -A structure of information that represents the arborescencse of the different assamblajes,represented in a  :class:`.Product` . (Including his spatial location and orientation) 
     62    -A structure of information that represents the arborescencse of the different assemblys,represented in a  :class:`.Product` . (Including his spatial location and orientation and his label of reference (**OCC.TDF.TDF_Label**)) 
     63     
     64     
     65    This class is invoked from three different subprocesses related to the functionality of pythonOCC(generate3D.py , generateComposition.py , generateDecomposition.py). 
     66     
    5667   """ 
    5768     
     
    7586        self.h_doc = TDocStd.Handle_TDocStd_Document() 
    7687        self.app = XCAFApp.GetApplication().GetObject() 
    77         self.app.NewDocument(TCollection_ExtendedString("MDTV-XCAF"),self.h_doc) 
    78         """ 
    79           Formats.Append(TCollection_ExtendedString (""));   
    80           Formats.Append(TCollection_ExtendedString ("XmlXCAF")); 
    81           Formats.Append(TCollection_ExtendedString ("XmlOcaf")); 
    82           Formats.Append(TCollection_ExtendedString ("MDTV-Standard")); 
    83         """ 
     88        self.app.NewDocument(TCollection_ExtendedString("MDTV-XCAF"),self.h_doc) #  "XmlXCAF" "XmlOcaf" "MDTV-Standard" 
     89 
     90 
    8491 
    8592        self.STEPReader.Transfer(self.h_doc) 
     
    107114        model.Clear()           
    108115    def procesing_geometrys(self,location): 
    109  
     116        """ 
     117        :param location: Path where to store the files **.geo** generated       
     118         
     119        For every simple shape it generates a file **.geo** representatively of his geometry,the content of the file is identified by an index and **self.id** 
     120        Returns the list of the path of the generated **.geo** files 
     121        """ 
    110122        files_index="" 
    111123         
     
    121133    def generate_product_arbre(self): 
    122134     
     135        """     
     136         
     137        Generates a :class:`.Product` relative to the assemblys of the file **.stp**, for every node of the :class:`.Product` it includes a label (**OCC.TDF.TDF_Label**) that represents and identifies the node 
     138         
     139        """     
     140     
    123141        roots = TDF_LabelSequence() 
    124142        self.shape_tool.GetFreeShapes(roots) 
     
    140158          
    141159class simple_shape(): 
     160 
     161    """ 
     162    Class used to represent a simple geometry ,(not assembly)  
     163    
     164     
     165     
     166    :model attributes: 
     167         
     168         
     169    .. attribute:: name 
     170     
     171        Name of geometry  
     172 
     173    .. attribute:: locations 
     174     
     175        :class:`Matrix_rotation` of each instances of the :class:`Link`  
     176                
     177    .. attribute:: product 
     178    """     
    142179 
    143180    def __init__(self, name,TopoDS_Shape,color): 
  • trunk/openPLM/document3D/classes.py

    r1022 r1024  
    335335    :param name: name of :class:`Product` for that we look 
    336336    :param doc_id: id of :class:`.DocumentFile` that contains the :class:`Product` for that we look 
    337     :param label: label generated by pythonOCC that represent the :class:`Product` for that we look 
     337    :param label: **OCC.TDF.TDF_Label** generated by pythonOCC that represent the :class:`Product` for that we look 
    338338          
    339339    Function that it checks if a :class:`Product` (determined by **name** , **id** and **geometry** or by **name** and **label**)is already present in a arborescense :class:`Product` (**product_root**) 
    340     There are two manners of comparison, across **name** and **label_referencia**, generated for pythonOCC for every product, or across **name**, **doc_id** and **geometry** ,extracted of a file **.geo** 
     340    There are two manners of comparison, across **name** and **label_reference**, generated for pythonOCC for every product, or across **name**, **doc_id** and **geometry** ,extracted of a file **.geo** 
    341341    """ 
    342342   
  • trunk/openPLM/document3D/generate3D.py

    r1022 r1024  
    1010def generateGeometrys_Arborescense(doc_file_path,doc_file_id,location): 
    1111    """ 
    12     For a file STEP determined by his path, it generates his file .arb and his files .geo 
     12     
     13     
     14    :param doc_file_path: Path of a file **.stp** 
     15    :param doc_file_id: id that is applied for the generation of the tree **.arb** and the geometries **.geo** 
     16    :param location: Path where to store the files **.geo** and **.arb** generated      
     17     
     18       
     19    For a file STEP determined by his path (**doc_file_path**),  it generates his file **.arb** and his files **.geo** having count an **id** determined by **doc_file_id**  
     20    and return in stdout the list of paths of files generated 
     21     
    1322    """  
    1423    logging.getLogger("GarbageCollector").setLevel(logging.ERROR)     
     
    1726    geo=my_step_importer.procesing_geometrys(location) 
    1827    print geo 
    19     print write_ArbreFile(product_arbre,my_step_importer.fileName,location) 
     28    print write_ArbFile_from_Product(product_arbre,my_step_importer.fileName,location) 
    2029 
    2130 
    2231 
    23 def write_ArbreFile(product,fileName,location): 
     32def write_ArbFile_from_Product(product,fileName,location): 
    2433 
    25  
     34    """ 
     35     
     36     
     37    :param product: :class:`.Product` relative to the structure of assamblys of a file **.stp** 
     38    :param fileName: Name of the file **.stp** for which we are going to generate the file **.arb** 
     39    :param location: Path where to store the file **.arb** generated   
     40    """  
    2641     
    2742     
     
    3853    decomposable = "true" if product.links and product.is_decomposable else "false" 
    3954    return "ARB:%s\nDecomposable:%s\n" % (name, decomposable)  
    40      
    41 try:     
    42     generateGeometrys_Arborescense(sys.argv[1],sys.argv[2],sys.argv[3])         
    43 except Exception as excep: 
    44     if type(excep)==MultiRoot_Error: 
    45         sys.exit(-1) 
    46     elif type(excep)==OCC_ReadingStep_Error: 
    47         sys.exit(-2) 
    48     sys.exit(-3) 
     55 
     56if __name__ == "__main__":     
     57    try:     
     58        generateGeometrys_Arborescense(sys.argv[1],sys.argv[2],sys.argv[3])         
     59    except Exception as excep: 
     60        if type(excep)==MultiRoot_Error: 
     61            sys.exit(-1) 
     62        elif type(excep)==OCC_ReadingStep_Error: 
     63            sys.exit(-2) 
     64        sys.exit(-3) 
    4965 
    5066     
  • trunk/openPLM/document3D/generateComposition.py

    r1022 r1024  
    1818def composer(temp_file_name): 
    1919 
     20    """ 
     21     
     22    :param temp_file_name: path of a  :class:`.tempfile` **.arb** that contains the information to generate a :class:`.Product` relative to the arborescense of a **.stp** file 
    2023 
     24     
     25    For every node of the :class:`.Product`  the attribute **doc_file_path** indicates where is store the file **.stp** that represents the node 
     26     
     27    """ 
    2128     
    2229    output = open(temp_file_name.encode(),"r") 
     
    8188                                          
    8289                 
    83      
    84 composer(sys.argv[1])     
     90if __name__ == "__main__":     
     91    composer(sys.argv[1])   
     92   
    8593     
    8694     
  • trunk/openPLM/document3D/generateDecomposition.py

    r1022 r1024  
    2020def decomposer(path,temp_file_name): 
    2121 
     22    """ 
     23     
     24    :param path: Path of a file **.stp** 
     25    :param temp_file_name: path of a  :class:`.tempfile` **.arb** that contains the information to generate a :class:`.Product` relative to the arborescense of a **.stp** file 
    2226 
     27     
     28    For every node of the :class:`.Product`  the attribute **doc_file_path** indicates where it is necessary to store the file generate by the decomposition 
     29     
     30    """ 
    2331    output = open(temp_file_name.encode(),"r") 
    2432    old_product=Product_from_Arb(json.loads(output.read())) 
     
    6573 
    6674 
     75if __name__ == "__main__":     
     76    decomposer(sys.argv[1],sys.argv[2])  
    6777     
    68      
    69 decomposer(sys.argv[1],sys.argv[2])  
    7078 
     79 
  • trunk/openPLM/document3D/mesh.py

    r1022 r1024  
    4343from OCC.GarbageCollector import garbage 
    4444def mesh_shape(shape,filename,name): 
    45     """ Take a topods_shape instance, returns the tesselated object""" 
    46     ''' Connect a ode.Trimesh to this body. The mesh is generated from the MSH subpackage. vertices lits 
    47     and faces indices are passed to the trimesh. 
     45    """  
     46 
     47 
     48  
     49    Take a topods_shape instance, returns the tesselated object 
    4850    The default mesh precision is divided by the quality factor: 
    4951    - if quality_factor>1, the mesh will be more precise, i.e. more triangles (more precision, but also 
    5052    more memory consumption and time for the mesher, 
    5153    - if quality_factor<1, the mesh will be less precise. 
    52     By default, this argument is set to 1 : the default precision of the mesher is used. 
     54 
    5355    ''' 
     56    """ 
    5457 
    5558    quality_factor=0.3 
  • trunk/openPLM/document3D/models.py

    r1022 r1024  
    516516        -The bomb-child of Parts (in relation to the :class:`.Product` (generate across the **arbre**)) has been generated 
    517517         
    518         -For every :class:`.ParentChildLink` generated in the previous condition we attach all the :class:`.location_link` relatives 
     518        -For every :class:`.ParentChildLink` generated in the previous condition we attach all the :class:`.Location_link` relatives 
    519519         
    520520        -To every generated :class:`.Part` a :class:`.Document3D` has been attached and the :class:`.Document3D` as been set like the attribute PartDecompose of the :class:`.Part`  
     
    710710    Copy the content of :class:`.GeometryFile` determined by his index(**product**.geometry) belonging to the :class:`.DocumentFile` identified by **old_doc_id**  
    711711    generating a new entity :class:`.GeometryFile` connected to the :class:`.DocumentFile` (**doc_file**) 
     712     
     713    To differentiate the content of a file **.geo** we use the combination index more  :class:`.DocumentFile` **.id** 
    712714        
    713715    """    
Note: See TracChangeset for help on using the changeset viewer.