- Messages : 106
- Karma: 3
- Remerciements reçus 2
- Accueil
- Forum
- RhinoShack Forums
- Support et assistance
- Rhinoceros 3d
- polyedre irrégulier modifiable sous Rhono6
probleme simple dans script
- onlyforpeace
- Auteur du sujet
- Hors Ligne
- Expert Boarder
-
Réduire
Plus d'informations
il y a 4 ans 2 mois - il y a 4 ans 2 mois #261
par onlyforpeace
probleme simple dans script a été créé par onlyforpeace
Bonjour les rhinos...
voila un problème de script que je ne comprends pas:
u = ubound(arrbloc)
ReDim tribloc(u)
ReDim nametribloc(u)
j = 1
For i=0 To u
For Each strbloc In arrbloc
strname = rhino.objectname(strbloc)
If strname = j Then
tribloc(i) = strbloc
nametribloc(i) = rhino.ObjectName(strbloc)
End If
Next
j = j + 1
Next
la condition soulihgné dans le script ci dessus, ne mlarche pas...
si le nom de la pièce est égal à 1 tout comme la condition le j=1 et bien ça ne fonctionne pas... est ce pour une raison de caractère?
je viens de remarquer que le "strname" is a string and "j" an integer that is the mater?
voila un problème de script que je ne comprends pas:
u = ubound(arrbloc)
ReDim tribloc(u)
ReDim nametribloc(u)
j = 1
For i=0 To u
For Each strbloc In arrbloc
strname = rhino.objectname(strbloc)
If strname = j Then
tribloc(i) = strbloc
nametribloc(i) = rhino.ObjectName(strbloc)
End If
Next
j = j + 1
Next
la condition soulihgné dans le script ci dessus, ne mlarche pas...
si le nom de la pièce est égal à 1 tout comme la condition le j=1 et bien ça ne fonctionne pas... est ce pour une raison de caractère?
je viens de remarquer que le "strname" is a string and "j" an integer that is the mater?
Dernière édition: il y a 4 ans 2 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 2 mois - il y a 4 ans 2 mois #262
par SwissRhino
Possible... Essais
--Mitch
Réponse de SwissRhino sur le sujet probleme simple dans script
je viens de remarquer que le "strname" is a string and "j" an integer that is the mater?
Possible... Essais
If strname =Cstr(j) Then
--Mitch
Dernière édition: il y a 4 ans 2 mois par SwissRhino.
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 2 mois #263
par onlyforpeace
Réponse de onlyforpeace sur le sujet probleme simple dans script
Merci, ça marche...
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 2 mois #264
par onlyforpeace
Réponse de onlyforpeace sur le sujet probleme simple dans script
j'ai de nouveau un problème, dans le script suivant, il me dit que le next ne devrait pas être là...
For Each strbloc In tribloc
rhino.SelectObject strbloc
arrbox = rhino.BoundingBox(strbloc)
xbox = round(arrbox(1)(0) - arrbox(0)(0), 0)
ybox = round(arrbox(3)(1) - arrbox(0)(1), 0)
zbox = round(arrbox(4)(2) - arrbox(0)(2), 0)
epbloc = rhino.objectlayer(strbloc)
'Select Case epbloc
If epbloc = "PSE ep100" Then
If xbox = 100 Then
arrOrigine = array(arrbox(1), arrbox(5), arrbox(2))
arrDestination = array(pt1, array(pt1(0) + 1, pt1(1), 0), array(pt1(0), pt1(1) + 1, 0))
strbloc2 = Rhino.OrientObject(strbloc, arrOrigine, arrDestination, 1)
Else If ybox = 100 Then
arrOrigine = array(arrbox(3), arrbox(2), arrbox(7))
arrDestination = array(pt1, array(pt1(0) + 1, pt1(1), 0), array(pt1(0), pt1(1) + 1, 0))
strbloc2 = Rhino.OrientObject(strbloc, arrOrigine, arrDestination, 1)
Else If zbox = 100 Then
arrOrigine = array(arrbox(0), arrbox(1), arrbox(3))
arrDestination = array(pt1, array(pt1(0) + 1, pt1(1), 0), array(pt1(0), pt1(1) + 1, 0))
strbloc2 = Rhino.OrientObject(strbloc, arrOrigine, arrDestination, 1)
End If
End If
If epbloc = "PSE ep200" Then
If xbox = 200 Then
arrOrigine = array(arrbox(1), arrbox(5), arrbox(2))
arrDestination = array(pt1, array(pt1(0) + 1, pt1(1), 0), array(pt1(0), pt1(1) + 1, 0))
strbloc2 = Rhino.OrientObject(strbloc, arrOrigine, arrDestination, 1)
Else If ybox = 200 Then
arrOrigine = array(arrbox(3), arrbox(2), arrbox(7))
arrDestination = array(pt1, array(pt1(0) + 1, pt1(1), 0), array(pt1(0), pt1(1) + 1, 0))
strbloc2 = Rhino.OrientObject(strbloc, arrOrigine, arrDestination, 1)
Else If zbox = 200 Then
arrOrigine = array(arrbox(0), arrbox(1), arrbox(3))
arrDestination = array(pt1, array(pt1(0) + 1, pt1(1), 0), array(pt1(0), pt1(1) + 1, 0))
strbloc2 = Rhino.OrientObject(strbloc, arrOrigine, arrDestination, 1)
End If
end if
If epbloc = "PSE ep400" Then
If xbox = 400 Then
arrOrigine = array(arrbox(1), arrbox(5), arrbox(2))
arrDestination = array(pt1, array(pt1(0) + 1, pt1(1), 0), array(pt1(0), pt1(1) + 1, 0))
strbloc2 = Rhino.OrientObject(strbloc, arrOrigine, arrDestination, 1)
Else If ybox = 400 Then
arrOrigine = array(arrbox(3), arrbox(2), arrbox(7))
arrDestination = array(pt1, array(pt1(0) + 1, pt1(1), 0), array(pt1(0), pt1(1) + 1, 0))
strbloc2 = Rhino.OrientObject(strbloc, arrOrigine, arrDestination, 1)
Else If zbox = 400 Then
arrOrigine = array(arrbox(0), arrbox(1), arrbox(3))
arrDestination = array(pt1, array(pt1(0) + 1, pt1(1), 0), array(pt1(0), pt1(1) + 1, 0))
strbloc2 = Rhino.OrientObject(strbloc, arrOrigine, arrDestination, 1)
End If
End If
pt1 = array(pt1(0) + (pt1(1) - pt1(0)), pt1(1), pt1(2))
Next
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 2 mois - il y a 4 ans 2 mois #265
par onlyforpeace
Réponse de onlyforpeace sur le sujet probleme simple dans script
j’essaie de remplacer if...then elseif par des select case... mais cela ne fonctionne pas non plus... et je ne trouve pas d'exemple dans l'aide rhino script...
epbloc = rhino.objectlayer(strbloc)
Select Case epbloc
Case "PSE ep100"
If xbox = 100 Then
arrOrigine = array(arrbox(1), arrbox(5), arrbox(2))
arrDestination = array(pt1, array(pt1(0) + 1, pt1(1), 0), array(pt1(0), pt1(1) + 1, 0))
strbloc2 = Rhino.OrientObject(strbloc, arrOrigine, arrDestination, 1)
Else If ybox = 100 Then
arrOrigine = array(arrbox(3), arrbox(2), arrbox(7))
arrDestination = array(pt1, array(pt1(0) + 1, pt1(1), 0), array(pt1(0), pt1(1) + 1, 0))
strbloc2 = Rhino.OrientObject(strbloc, arrOrigine, arrDestination, 1)
Else If zbox = 100 Then
arrOrigine = array(arrbox(0), arrbox(1), arrbox(3))
arrDestination = array(pt1, array(pt1(0) + 1, pt1(1), 0), array(pt1(0), pt1(1) + 1, 0))
strbloc2 = Rhino.OrientObject(strbloc, arrOrigine, arrDestination, 1)
End If
Case "PSE ep200"
If xbox = 200 Then
arrOrigine = array(arrbox(1), arrbox(5), arrbox(2))
arrDestination = array(pt1, array(pt1(0) + 1, pt1(1), 0), array(pt1(0), pt1(1) + 1, 0))
strbloc2 = Rhino.OrientObject(strbloc, arrOrigine, arrDestination, 1)
Else If ybox = 200 Then
arrOrigine = array(arrbox(3), arrbox(2), arrbox(7))
arrDestination = array(pt1, array(pt1(0) + 1, pt1(1), 0), array(pt1(0), pt1(1) + 1, 0))
strbloc2 = Rhino.OrientObject(strbloc, arrOrigine, arrDestination, 1)
Else If zbox = 200 Then
arrOrigine = array(arrbox(0), arrbox(1), arrbox(3))
arrDestination = array(pt1, array(pt1(0) + 1, pt1(1), 0), array(pt1(0), pt1(1) + 1, 0))
strbloc2 = Rhino.OrientObject(strbloc, arrOrigine, arrDestination, 1)
End If
Case "PSE ep400"
If xbox = 400 Then
arrOrigine = array(arrbox(1), arrbox(5), arrbox(2))
arrDestination = array(pt1, array(pt1(0) + 1, pt1(1), 0), array(pt1(0), pt1(1) + 1, 0))
strbloc2 = Rhino.OrientObject(strbloc, arrOrigine, arrDestination, 1)
Else If ybox = 400 Then
arrOrigine = array(arrbox(3), arrbox(2), arrbox(7))
arrDestination = array(pt1, array(pt1(0) + 1, pt1(1), 0), array(pt1(0), pt1(1) + 1, 0))
strbloc2 = Rhino.OrientObject(strbloc, arrOrigine, arrDestination, 1)
Else If zbox = 400 Then
arrOrigine = array(arrbox(0), arrbox(1), arrbox(3))
arrDestination = array(pt1, array(pt1(0) + 1, pt1(1), 0), array(pt1(0), pt1(1) + 1, 0))
strbloc2 = Rhino.OrientObject(strbloc, arrOrigine, arrDestination, 1)
End If
End Select
Dernière édition: il y a 4 ans 2 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 2 mois - il y a 4 ans 2 mois #266
par SwissRhino
Réponse de SwissRhino sur le sujet probleme simple dans script
Est-ce que tu peux poster le script en entier ainsi que un fichier exemple pour tester?
Ce que je vois: dans le cas qu'un objet ne correspond à aucun de tes critères, il n'y a pas d'échappatoire - un erreur se produira au niveau de la ligne
--Mitch
Ce que je vois: dans le cas qu'un objet ne correspond à aucun de tes critères, il n'y a pas d'échappatoire - un erreur se produira au niveau de la ligne
pt1 = array(pt1(0) + (pt1(1) - pt1(0)), pt1(1), pt1(2))
--Mitch
Dernière édition: il y a 4 ans 2 mois par SwissRhino.
Connexion pour participer à la conversation.
Temps de génération de la page : 0.413 secondes