Index » PageStream Support » Windows » GetSelectedObjects
Sign in to add a comment. Pages: 1
2006-08-10 18:59:51 CT #1
andremonerau
From: Unknown
Registered: 2004-11-18
Posts: 7

La fonction "GetSelectedObjects" ne fonctionne plus dans la version 5.0.3.3
The function "GetSelectedObjects" does not function any more in version
5.0.3.3

Le script ci dessous fonctionne très bien en 5.0.2.1 mais pas en 5.0.3.3
script below functions very well into 5.0.2.1 but not into 5.0.3.3

This is a machine translation by Internet. Excuse me, but I do not speak
English.
Thank you by advance.

André MONERAU.

Windows XP, pentium4 and PAGESTREAM, c'est le pouvoir!
Windows XP, pentium4 and PAGESTREAM, it is the absolute power!
---------------------------------------------------------------------------

# 2 segments perpendiculaires à 2 droites sélectionnée
# 2 segments perpendicular on 2 lines selected

from math import *
from PageStream import *

# CHECK FOR LINE OBJECT */

Objets = GetSelectedObjects("idlist", "maliste")
if Objets['.error'] == 0 or Objets['.result'] != 2:
AlertRequester(AlertType_Error, "Il faut 2 objets séléctionnés.", "Ok")

D1 = Objets['maliste']['0']
Ligne1 = GetLine("POSITION", "bouts", "OBJECTID", D1)
D2 = Objets['maliste']['1']
Ligne2 = GetLine("OBJECTID", D2, "POSITION", "bouts")

if Ligne1['.error'] == 0 or Ligne2['.error'] == 0:
AlertRequester(AlertType_Error, "Il faut 2 droites séléctionnées.",
"Ok")

CursposPoint = GetCoord("stem","message","cliquer au point de passage")
if CursposPoint['.error'] == 0:
AlertRequester(AlertType_Error, "Unable to get cursor Extrstatus.", "OK")
yp = CursposPoint['stem']['x']
xp = CursposPoint['stem']['y']

x1p1 = Ligne1['bouts']['top']
x1p2 = Ligne1['bouts']['bottom']
y1p1 = Ligne1['bouts']['left']
y1p2 = Ligne1['bouts']['right']

Num1 = (xp-x1p1)*(x1p2-x1p1)+(yp-y1p1)*(y1p2-y1p1)
Denom1 = (x1p2-x1p1)*(x1p2-x1p1)+(y1p2-y1p1)*(y1p2-y1p1)
lembda1 = Num1 / Denom1

x1h = x1p1+lembda1 * (x1p2-x1p1)
y1h = y1p1+lembda1 * (y1p2-y1p1)

SetToolMode("LINE")
DrawLine(y1h, x1h, yp, xp)

x2p1 = Ligne2['bouts']['top']
x2p2 = Ligne2['bouts']['bottom']
y2p1 = Ligne2['bouts']['left']
y2p2 = Ligne2['bouts']['right']

Num2 = (xp-x2p1)*(x2p2-x2p1)+(yp-y2p1)*(y2p2-y2p1)
Denom2 = (x2p2-x2p1)*(x2p2-x2p1)+(y2p2-y2p1)*(y2p2-y2p1)
lembda2 = Num2 / Denom2

x2h = x2p1+lembda2 * (x2p2-x2p1)
y2h = y2p1+lembda2 * (y2p2-y2p1)

SetToolMode("LINE")

DrawLine(y2h, x2h, yp, xp)

SetToolMode("OBJECT")
RefreshWindows()
--------------------------------------------------------------------------


[Non-text portions of this message have been removed]


2006-08-10 18:12:42 CT #2
Danny Boy
From: United States
Registered: 2006-03-21
Posts: 290

Well, I am no expert, but the output I got was:

D1 = Objets['maliste']['0']
TypeError: list indices must be integers

Which tells me that

>D1 = Objets['maliste']['0']
>D2 = Objets['maliste']['1']

should be:

D1 = Objets['maliste'][0]
D2 = Objets['maliste'][1]

Does that work for you?

Dan

>La fonction "GetSelectedObjects" ne fonctionne plus dans la version 5.0.3.3
>The function "GetSelectedObjects" does not function any more in version
>5.0.3.3
>
>Le script ci dessous fonctionne très bien en 5.0.2.1 mais pas en 5.0.3.3
> script below functions very well into 5.0.2.1 but not into 5.0.3.3
>
>This is a machine translation by Internet. Excuse me, but I do not speak
>English.
>Thank you by advance.
>
>André MONERAU.
>
>Windows XP, pentium4 and PAGESTREAM, c'est le pouvoir!
>Windows XP, pentium4 and PAGESTREAM, it is the absolute power!
>---------------------------------------------------------------------------
>
># 2 segments perpendiculaires à 2 droites sélectionnée
># 2 segments perpendicular on 2 lines selected
>
>from math import *
>from PageStream import *
>
># CHECK FOR LINE OBJECT */
>
>Objets = GetSelectedObjects("idlist", "maliste")
>if Objets['.error'] == 0 or Objets['.result'] != 2:
> AlertRequester(AlertType_Error, "Il faut 2 objets séléctionnés.", "Ok")
>
>D1 = Objets['maliste']['0']
>Ligne1 = GetLine("POSITION", "bouts", "OBJECTID", D1)
>D2 = Objets['maliste']['1']
>Ligne2 = GetLine("OBJECTID", D2, "POSITION", "bouts")
>
>if Ligne1['.error'] == 0 or Ligne2['.error'] == 0:
> AlertRequester(AlertType_Error, "Il faut 2 droites séléctionnées.",
>"Ok")
>
>CursposPoint = GetCoord("stem","message","cliquer au point de passage")
>if CursposPoint['.error'] == 0:
> AlertRequester(AlertType_Error, "Unable to get cursor Extrstatus.", "OK")
>yp = CursposPoint['stem']['x']
>xp = CursposPoint['stem']['y']
>
>x1p1 = Ligne1['bouts']['top']
>x1p2 = Ligne1['bouts']['bottom']
>y1p1 = Ligne1['bouts']['left']
>y1p2 = Ligne1['bouts']['right']
>
>Num1 = (xp-x1p1)*(x1p2-x1p1)+(yp-y1p1)*(y1p2-y1p1)
>Denom1 = (x1p2-x1p1)*(x1p2-x1p1)+(y1p2-y1p1)*(y1p2-y1p1)
>lembda1 = Num1 / Denom1
>
>x1h = x1p1+lembda1 * (x1p2-x1p1)
>y1h = y1p1+lembda1 * (y1p2-y1p1)
>
>SetToolMode("LINE")
>DrawLine(y1h, x1h, yp, xp)
>
>x2p1 = Ligne2['bouts']['top']
>x2p2 = Ligne2['bouts']['bottom']
>y2p1 = Ligne2['bouts']['left']
>y2p2 = Ligne2['bouts']['right']
>
>Num2 = (xp-x2p1)*(x2p2-x2p1)+(yp-y2p1)*(y2p2-y2p1)
>Denom2 = (x2p2-x2p1)*(x2p2-x2p1)+(y2p2-y2p1)*(y2p2-y2p1)
>lembda2 = Num2 / Denom2
>
>x2h = x2p1+lembda2 * (x2p2-x2p1)
>y2h = y2p1+lembda2 * (y2p2-y2p1)
>
>SetToolMode("LINE")
>
>DrawLine(y2h, x2h, yp, xp)
>
>SetToolMode("OBJECT")
>RefreshWindows()
>--------------------------------------------------------------------------


We appreciate your business!

Dan Kilroy - Sales <sales@pagestream.org>

Grasshopper LLC
N5750 Langlade Price Road
Bryant WI 54418 USA
http://www.pagestream.org
PageStream DTP for Amiga, Linux, Macintosh, and Windows


2006-08-11 14:07:13 CT #3
andremonerau
From: Unknown
Registered: 2004-11-18
Posts: 7

Well, I am no expert, but the output I got was:

D1 = Objets['maliste']['0']
TypeError: list indices must be integers

Which tells me that

>D1 = Objets['maliste']['0']
>D2 = Objets['maliste']['1']

should be:

D1 = Objets['maliste'][0]
D2 = Objets['maliste'][1]

Does that work for you?

Dan
Merci encore pour cette réponse rapide et efficace.
Thank you still for this fast and effective answer.

Cela marche parfaitement.
That goes perfectly.

Bravo encore a Pagestream et aux gens comme vous qui aident tous les
utilisateurs.
Cheer still has Pagestream and with people as you who help all the users.

André MONERAU.

Windows XP, pentium4 and PAGESTREAM 5 pro, c'est le pouvoir!
Windows XP, pentium4 and PAGESTREAM 5 pro, it is the absolute power!


[Non-text portions of this message have been removed]


Sign in to add a comment. Pages: 1
Index » PageStream Support » Windows » GetSelectedObjects

This topic is closed due to inactivity.