Skip to content

Commit

Permalink
Creation dans le rep
Browse files Browse the repository at this point in the history
  • Loading branch information
baptistem committed May 18, 2013
1 parent 498c81c commit 723ab79
Show file tree
Hide file tree
Showing 7 changed files with 1,608 additions and 0 deletions.
32 changes: 32 additions & 0 deletions plugins/solidworks/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#
# OpenPLM module
#

#***************************************************************************
#* This file is part of the OpenPLM plugin for SWCAD. *
#* *
#* This program is free software; you can redistribute it and/or modify *
#* it under the terms of the GNU General Public License (GPL) *
#* as published by the Free Software Foundation; either version 2 of *
#* the License, or (at your option) any later version. *
#* for detail see the LICENCE text file. *
#* *
#* SWCAD is distributed in the hope that it will be useful, *
#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
#* GNU Library General Public License for more details. *
#* *
#* You should have received a copy of the GNU Library General Public *
#* License along with this plugin; if not, write to the Free Software *
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
#* USA *
#* *
#***************************************************************************/

# Authors
# Baptiste M <[email protected]>

pour installer le module, il faut juste l'executer dans pythonwin

le service COM est lance en mode "debug" donc la fenetre "TOOLS > TRACE COLLECTOR DEBUG TOOLS", il y a max de message qui s'affiche

99 changes: 99 additions & 0 deletions plugins/solidworks/SWCAD.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
#
# OpenPLM module
#

#***************************************************************************
#* This file is part of the OpenPLM plugin for SWCAD. *
#* *
#* This program is free software; you can redistribute it and/or modify *
#* it under the terms of the GNU General Public License (GPL) *
#* as published by the Free Software Foundation; either version 2 of *
#* the License, or (at your option) any later version. *
#* for detail see the LICENCE text file. *
#* *
#* SWCAD is distributed in the hope that it will be useful, *
#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
#* GNU Library General Public License for more details. *
#* *
#* You should have received a copy of the GNU Library General Public *
#* License along with this plugin; if not, write to the Free Software *
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
#* USA *
#* *
#***************************************************************************/

# Authors
# Baptiste M <[email protected]>

#
# 18/5/2013 : Fonctionne en partie
# configure ( pour choisir le serveur )
# login
# le create document
# j'ai essayé de faire un truc generique pour les version de solidworks... mais je n'ai testé que sur ma version 2010
#
# un test et debugage sur les autres...
#


print("Import SWCAD")

class Convertisseur:
def __init__(self):
pass
def saveImage(self,nom):
print(nom)
G = open(nom,"w+")
G.write(nom)
G.close()

class Document:
def __init__(self):
self.FileName = "BMA.sldrt"
self.Objects = []
self.Label = ""
def ActiveView(self):
return Convertisseur()
def ActiveDocument():
print("Active Document")
import win32com.client
SW = win32com.client.Dispatch("SldWorks.Application")
swModel = SW.ActiveDoc
if ( swModel is None):
nom_fichier=""
print("Pas de fichier selectionne")
else:
nom_fichier=swModel.GetPathName
print(nom_fichier)
D = Document()
D.FileName = nom_fichier
return D
def openDocument(chemin):
print("OPEN DOCUMENT",chemin)
import win32com.client
SW = win32com.client.Dispatch("SldWorks.Application")
SW.Visible = 1
a=0
b=0
if ( str(chemin).lower()[:-5] == "sldprt"):
swModel = SW.OpenDoc(chemin,1)
if ( str(chemin).lower()[:-5] == "sldasm"):
swModel = SW.OpenDoc(chemin,2)
D = Document()
D.FileName = chemin
return D
def closeDocument(chemin):
print("Close Document",chemin)
import win32com.client
SW = win32com.client.Dispatch("SldWorks.Application")
SW.Visible = 1
swModel = SW.ActiveDoc
if ( swModel is None):
nom_fichier=""
print("Pas de fichier selectionne")
else:
nom_fichier=swModel.GetPathName
print(nom_fichier,chemin)
swModel.Close

55 changes: 55 additions & 0 deletions plugins/solidworks/SWCADGui.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#
# OpenPLM module
#

#***************************************************************************
#* This file is part of the OpenPLM plugin for SWCAD. *
#* *
#* This program is free software; you can redistribute it and/or modify *
#* it under the terms of the GNU General Public License (GPL) *
#* as published by the Free Software Foundation; either version 2 of *
#* the License, or (at your option) any later version. *
#* for detail see the LICENCE text file. *
#* *
#* SWCAD is distributed in the hope that it will be useful, *
#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
#* GNU Library General Public License for more details. *
#* *
#* You should have received a copy of the GNU Library General Public *
#* License along with this plugin; if not, write to the Free Software *
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
#* USA *
#* *
#***************************************************************************/

# Authors
# Baptiste M <[email protected]>

#
# 18/5/2013 : Fonctionne en partie
# configure ( pour choisir le serveur )
# login
# le create document
# j'ai essayé de faire un truc generique pour les version de solidworks... mais je n'ai testé que sur ma version 2010
#
# un test et debugage sur les autres...
#


global COMMANDE_LISTE
COMMANDE_LISTE={}
def updateGui():
print("UPDATE GUI")
##import win32com.client
##SW = win32com.client.Dispatch("SldWorks.Application")
##SW.Visible = 1
##SW.ForceRebuild3(True)


def runCommand(chaine):
print("RUN COMMAND ",chaine)
def addCommand(chaine,object):
print("ADD COMMAND",chaine)
COMMANDE_LISTE[chaine] = object

Loading

0 comments on commit 723ab79

Please sign in to comment.