Sorry for the delay, I was out of the office last week.
I tryed to change my code to "World" coordsys but the result is continued to be different.
print $Caisson_042
$Editable_Poly:Caisson_042 @ [2438.399902,0.000000,0.000000]
x = (coordsys world $Caisson_042.pos.x)
0.0
y = (coordsys world $Caisson_042.pos.y)
0.0
z = (coordsys world $Caisson_042.pos.z)
0.0
I put all my code, if it can help to fix the error
My code take input in excel sheet and make an assembly of barges of 40'x8' and 20'x8' in staggered rows like brick wall
resetMaxFile(#noPrompt)
-- Chemins d'acces
oPath20 = "my_path\\Caisson 20.max"
oPath40 = "my_path\\Caisson 40.max"
-- Prendre les infos du fichier Excel
excelFile = "my_path\\BOC - parametre de dessin.xlsx"
-- Start an Excel OLE Object
x = CreateOLEObject "Excel.Application"
-- Create a new workbook in the new excel document
x.application.Workbooks.open(excelFile)
oColCount40 = (x.application.cells 30 2).value
oColSpacing40 = (x.application.cells 27 4).value
oColCount20 = (x.application.cells 31 2).value
oColSpacing20 = (x.application.cells 29 4).value
oRowCount = (x.application.cells 32 2).value
oRowSpacing = (x.application.cells 28 4).value
oNbSpuds = (x.application.cells 40 2).value
-- Close the spreadsheet
x.application.ActiveWorkbook.Close
-------------------------------------------------------------------------
-- Inserer le premier caisson 40'
myNewObjs = getMAXFileObjectNames oPath40
theXrefBox = xrefs.addNewXrefObject oPath40 myNewObjs
-- Pattern 40' de la premiere ligne
Caisson_40 = for item in myNewObjs collect getNodeByName item
i=0
for i = 1 to oColCount40-1
do
(
maxOps.CloneNodes Caisson_40 \
offset:[0 ,i*oColSpacing40, 0] \
expandHierarchy:true \
cloneType:#instance \
newNodes:&newnode
)
--------------------------------------------------------------------------
If ((mod oRowCount 2) == 0) do
(
print "Largeur PAIR"
If (oColCount20 == 1) do
(
print "Besoin 20 sur long"
-- insérer le dernier caisson BOC-20 à la fin de la 1ere rangée
myNewObjs = ""
myNewObjs = getMAXFileObjectNames oPath20
objXRefMgr.dupMtlNameAction = #useXRefed
objXRefMgr.AddXRefItemsFromFile oPath20 objNames: myNewObjs promptObjNames:false
Caisson_20 = for item in myNewObjs collect getNodeByName item
move Caisson_20 [0, oColCount40*oColSpacing40, 0]
-- insérer le premier caisson BOC-20 au début dse la 2eme rangée
maxOps.CloneNodes Caisson_20 \
offset:[oRowSpacing , 0, 0] \
expandHierarchy:true \
cloneType:#instance \
newNodes:&newnode
-- insérer le premier caisson BOC-40 au début dse la 2eme rangée
maxOps.CloneNodes Caisson_40 \
offset:[oRowSpacing ,oColSpacing20, 0] \
expandHierarchy:true \
cloneType:#instance \
newNodes:&newnode
-- Pattern 40' de 2eme ligne
i=0
for i = 1 to oColCount40-1
do
(
maxOps.CloneNodes Caisson_40 \
offset:[oRowSpacing ,oColSpacing20+i*oColSpacing40, 0] \
expandHierarchy:true \
cloneType:#instance \
newNodes:&newnode
)
XrefBind = ($*)
XrefCount = xrefs.getXRefFileCount()
for i = 1 to XrefCount do
(
CurrXRef = xrefs.getXRefFile i
for o in XrefBind do
(
if o == CurrXRef.parent do
(
UpdateXRef CurrXRef
)
)
)
aSelection = ( XrefBind as array ) --store the selection in an array
i=0
j=0
for i = 1 to ((oRowCount/2)-1) do
(
for j = 1 to aSelection.count do
(
obj = aSelection[j] --pull the object from the array at index j
x = (coordsys world obj.pos.x)
y = (coordsys world obj.pos.y)
z = (coordsys world obj.pos.z)
print obj
format "X:%, Y:%, Z:%\n" x y z
maxOps.CloneNodes obj \
offset:[x+(i*oRowSpacing*2) , y, 0] \
expandHierarchy:true \
cloneType:#instance \
newNodes:&newnode
)
)
-- Insérer le plan (eau)
Plane length:100000 width:100000 pos:[0, 0, 0] \
isSelected:on lengthsegs:100 widthsegs:100
)
)
thanks for your help