- Messages : 106
- Karma: 3
- Remerciements reçus 2
- Accueil
- Forum
- RhinoShack Forums
- Support et assistance
- Rhino Script
- problème de script
problème de script
- onlyforpeace
- Auteur du sujet
- Hors Ligne
- Expert Boarder
-
Réduire
Plus d'informations
il y a 4 ans 8 mois #208
par onlyforpeace
problème de script a été créé par onlyforpeace
j'ai un souci avec un script. lorsqu'il est dans un bouton avec la commande runscript, il ne fonctionne pas, me laissant un message d'erreur:
Erreur d’exécution Microsoft VBscript
Nombre d'arguments ou affectation de propriété incorrects:'tricadre'
mais quand je l’exécute depuis la fenêtre editscript dans rhino, il fonctionne...
une idée?
Erreur d’exécution Microsoft VBscript
Nombre d'arguments ou affectation de propriété incorrects:'tricadre'
mais quand je l’exécute depuis la fenêtre editscript dans rhino, il fonctionne...
une idée?
Connexion pour participer à la conversation.
- SwissRhino
- Hors Ligne
- Modérateur
-
Réduire
Plus d'informations
- Messages : 81
- Karma: 2
- Remerciements reçus 11
il y a 4 ans 8 mois #210
par SwissRhino
Réponse de SwissRhino sur le sujet problème de script
Est-ce que peux poster le script en question ? --Mitch
Connexion pour participer à la conversation.
- onlyforpeace
- Auteur du sujet
- Hors Ligne
- Expert Boarder
-
Réduire
Plus d'informations
- Messages : 106
- Karma: 3
- Remerciements reçus 2
il y a 4 ans 8 mois - il y a 4 ans 8 mois #211
par onlyforpeace
Réponse de onlyforpeace sur le sujet problème de script
c'est un script qui me sert à exporter des panneaux en dxf pour de la découpe.
ce script repertori toute les panneaux complets ( qui appartiennent à un calque ( qu'il faut choisir à un moment))
le script les classes de gauche à droite, les nomes puis les déplace au zéro pour les exporter vers un dossier...
voila le code:
ce script repertori toute les panneaux complets ( qui appartiennent à un calque ( qu'il faut choisir à un moment))
le script les classes de gauche à droite, les nomes puis les déplace au zéro pour les exporter vers un dossier...
voila le code:
! _-runscript (
Option Explicit
'Script written by <insert name>
'Script copyrighted by <insert company name>
'Script version lundi 11 avril 2016 13:08:43
Call Main()
Sub Main()
If Year(Date) > 2017 Then Exit Sub
If year(Date) = 2017 Then
If Month(Date) > 3 Then Exit Sub
End If
'Create file system object (FSO) to be able to work with file system
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
Dim strclient,strprojet,prefix
Dim chemo,newchem,chemdebit1,chemdebit2,chemdebit3,pos,n,seq,chemsave
Dim intCompteur, strNomFichier,chemdebit
Dim arrcadre, strcadre,layercadre,arrbox,aexporter
Dim arrObjects, dblDec, arrdec,arrBound, arrOrigine
Dim strtexte, arrObjCopy, arrChoix, strResult, intOrigine
Dim arrGroups, strGroup, arrNom
chemo = Rhino.documentPath
If Not isnull(chemo) Then
pos = instr(chemo, "Plans")
seq = Split(chemo, "\")
'definitions nom de projet et client
If isnull(Rhino.GetDocumentUserText("clientdocument")) Then
strclient = rhino.stringbox("CLIENT?", seq(3), "définition client")
Else
strclient = rhino.stringbox("CLIENT?", Rhino.GetDocumentUserText("clientdocument"), "définition client")
End If
If isnull(strclient) Then Exit Sub
If isnull(Rhino.GetDocumentUserText("projetdocument")) Then
strprojet = rhino.StringBox("PROJET?", seq(4), "définition projet")
Else
strprojet = rhino.stringbox("PROJET?", Rhino.GetDocumentUserText("projetdocument"), "définition projet")
End If
If isnull(strprojet) Then Exit Sub
prefix = rhino.stringbox("prefix?", strclient & strprojet)
If isnull(prefix) Then Exit Sub
End If
prefix = rhino.stringbox("prefix?")
'definition du chemin et création des repertoires
If pos = 0 Then
pos = instr(chemo, "Plan")
n = 1
End If
If isnull(pos) Then
rhino.MessageBox "fichier non repertorier", 0
chemdebit1 = Rhino.BrowseForFolder("X:\clients\", "choisi le dossier de sauvegarde")
If isnull(chemdebit1) Then Exit Sub
chemdebit2 = chemdebit1 & "DEBIT2D"
chemdebit3 = chemdebit2 & "\" & prefix
End If
If Not isnull(pos) And n = 0 Then
newchem = left(chemo, pos + 5)
chemdebit1 = newchem & "USINAGE"
chemdebit2 = chemdebit1 & "\DEBIT2D"
chemdebit3 = chemdebit2 & "\" & prefix
End If
If Not isnull(pos) And n = 1 Then
newchem = left(chemo, pos + 4)
chemdebit1 = newchem & "USINAGE"
chemdebit2 = chemdebit1 & "\DEBIT2D"
chemdebit3 = chemdebit2 & "\" & prefix
End If
If Not fso.FolderExists(chemdebit1) Then
fso.CreateFolder chemdebit1
End If
If Not fso.FolderExists(chemdebit2) Then
fso.CreateFolder chemdebit2
End If
If Not fso.FolderExists(chemdebit3) Then
fso.CreateFolder chemdebit3
End If
If Not IsNull(prefix) Then
intCompteur = Rhino.GetInteger("Numéro de départ", 1)
'Sélectionne les objets à exporter en dxf
'continue jusqu'a ce que rien ne soit selectionné
arrcadre = Rhino.ObjectsByLayer(rhino.getlayer)
arrcadre = tricadre(arrcadre)
For Each strcadre In arrcadre
If Not IsNull(strcadre) Then
arrBox = Rhino.BoundingBox(strcadre)
If IsArray(arrBox) Then
aexporter = Rhino.ObjectsByRegion(Array(arrBox(0), arrBox(1), arrBox(2), arrBox(3), arrBox(0)), 0, 4)
End If
End If
Rhino.EnableRedraw False
Rhino.UnselectAllObjects
strNomFichier = prefix & "_" & intCompteur & ".dxf"
chemsave = chemdebit3 & "\" & strnomfichier
Rhino.SelectObjects(aexporter)
rhino.Command "_ProjectToCPlane" & " " & "Oui"
arrBound = Rhino.BoundingBox(Rhino.SelectedObjects())
'arrOrigine = Array((arrBound(2)(0) - arrBound(0)(0)) / 2 + arrBound(0)(0), (arrBound(2)(1) - arrBound(0)(1)) / 2 + arrBound(0)(1), arrBound(0)(2))
arrOrigine = arrBound(0)
arrNom = arrOrigine
arrNom(0) = arrNom(0) + 250
arrNom(1) = arrNom(1) + 250
Rhino.AddText strNomFichier, arrNom, 100
arrObjCopy = Rhino.CopyObjects(Rhino.SelectedObjects(), arrOrigine, array(0, 0, 0))
rhino.Command "_Hide"
Rhino.UnselectAllObjects
Rhino.SelectObjects arrObjCopy
Rhino.Command "-_Export" & " " & chr(34) & chemsave & chr(34) & " " & "_Enter"
Rhino.DeleteObjects(arrObjCopy)
Rhino.EnableRedraw True
intCompteur = intCompteur + 1
Next
End If
rhino.print chemdebit3
End Sub
Function tricadre(arrcadre)
Dim i, j, tmp,c1,c2
Rhino.EnableRedraw False
If IsArray(arrcadre) Then
For i = UBound(arrcadre) - 1 To 0 Step -1
For j = 0 To i
'rhino.selectobject arrcadre(j)
c1 = rhino.BoundingBox(arrcadre(j))
'rhino.selectobject arrcadre(j + 1)
c2 = rhino.BoundingBox(arrcadre(j + 1))
If c1(0)(0) > c2(0)(0) Then
tmp = arrcadre(j + 1)
arrcadre(j + 1) = arrcadre(j)
arrcadre(j) = tmp
End If
Rhino.UnselectObjects(arrcadre)
Next
Next
End If
If IsArray(arrcadre) Then
For i = UBound(arrcadre) - 1 To 0 Step -1
For j = 0 To i
'rhino.selectobject arrcadre(j)
c1 = rhino.BoundingBox(arrcadre(j))
'rhino.selectobject arrcadre(j + 1)
c2 = rhino.BoundingBox(arrcadre(j + 1))
If c1(0)(1) < c2(0)(1)Then
tmp = arrcadre(j + 1)
arrcadre(j + 1) = arrcadre(j)
arrcadre(j) = tmp
End If
Rhino.UnselectObjects(arrcadre)
Next
Next
End If
Rhino.EnableRedraw True
tricadre = arrcadre
End Function
Function tricadre ()
Dim arrcadre,strcadre,arrcadretri
End Function
Dernière édition: il y a 4 ans 8 mois par onlyforpeace.
Connexion pour participer à la conversation.
- SwissRhino
- Hors Ligne
- Modérateur
-
Réduire
Plus d'informations
- Messages : 81
- Karma: 2
- Remerciements reçus 11
il y a 4 ans 8 mois #212
par SwissRhino
Réponse de SwissRhino sur le sujet problème de script
Difficile à savoir exactement ce qui se passe, mais je vois que tu as défini la fonction tricadre() deux fois, une fois avec un seul argument et une deuxième fois juste après sans argument. C'est peut-être cela...
--Mitch
--Mitch
Connexion pour participer à la conversation.
Temps de génération de la page : 0.277 secondes