.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

C# and Autocad 2000 TranslateCoordinates

5 REPLIES 5
Reply
Message 1 of 6
Anonymous
677 Views, 5 Replies

C# and Autocad 2000 TranslateCoordinates

I'm trying to use Utility.TranslateCoordinates from a C# application. In
VB/VBA I only needed to provide the first four parameters with the fifth
being optional. In C# it seems I must provide all five parameters but I do
not know what to give it as the fifth. Does anyone have any ideas? I'm still
new to .Net/C# and have tried the following:

ActiveDoc.Utility.TranslateCoordinates(
tempPt,
AcCoordinateSystem.acWorld, A
cCoordinateSystem.acUCS,
0,
new double[] { 0.0, 0.0, 0.0 })

ActiveDoc.Utility.TranslateCoordinates(
tempPt,
AcCoordinateSystem.acWorld,
AcCoordinateSystem.acUCS,
0,
null)


thanks
LJB
5 REPLIES 5
Message 2 of 6
Anonymous
in reply to: Anonymous

Try System.Type.Missing

"LJB" wrote in message news:6058315@discussion.autodesk.com...
I'm trying to use Utility.TranslateCoordinates from a C# application. In
VB/VBA I only needed to provide the first four parameters with the fifth
being optional. In C# it seems I must provide all five parameters but I do
not know what to give it as the fifth. Does anyone have any ideas? I'm still
new to .Net/C# and have tried the following:

ActiveDoc.Utility.TranslateCoordinates(
tempPt,
AcCoordinateSystem.acWorld, A
cCoordinateSystem.acUCS,
0,
new double[] { 0.0, 0.0, 0.0 })

ActiveDoc.Utility.TranslateCoordinates(
tempPt,
AcCoordinateSystem.acWorld,
AcCoordinateSystem.acUCS,
0,
null)


thanks
LJB
Message 3 of 6
Anonymous
in reply to: Anonymous

That doesn't seem to do it. I still get "Cannot implicitly convert type
'object' to 'double[]'". The fifth parameter is declared as type "object" in
"TranslateCoordinates(object Point, AcCoordinateSystem FromCoordSystem,
AcCoordinateSystem ToCoordSystem, int Displacement, object OCSNormal)" yet
the compiler seems to be trying to convert this to double[]. The AutoCAD
help file describes the last parameter, OCSNormal, as a "Variant
(three-element array of doubles); input-only;optional" which is why I tried
new double[] { 0.0, 0.0, 0.0 }. I need another hint.

thanks


"Paul Richardson" wrote in message
news:6058394@discussion.autodesk.com...
Try System.Type.Missing

"LJB" wrote in message
news:6058315@discussion.autodesk.com...
I'm trying to use Utility.TranslateCoordinates from a C# application. In
VB/VBA I only needed to provide the first four parameters with the fifth
being optional. In C# it seems I must provide all five parameters but I do
not know what to give it as the fifth. Does anyone have any ideas? I'm still
new to .Net/C# and have tried the following:

ActiveDoc.Utility.TranslateCoordinates(
tempPt,
AcCoordinateSystem.acWorld, A
cCoordinateSystem.acUCS,
0,
new double[] { 0.0, 0.0, 0.0 })

ActiveDoc.Utility.TranslateCoordinates(
tempPt,
AcCoordinateSystem.acWorld,
AcCoordinateSystem.acUCS,
0,
null)


thanks
LJB
Message 4 of 6
Anonymous
in reply to: Anonymous

Seems you're passing null instead of 'System.Type.Missing' ?

"LJB" wrote in message news:6058411@discussion.autodesk.com...
That doesn't seem to do it. I still get "Cannot implicitly convert type
'object' to 'double[]'". The fifth parameter is declared as type "object" in
"TranslateCoordinates(object Point, AcCoordinateSystem FromCoordSystem,
AcCoordinateSystem ToCoordSystem, int Displacement, object OCSNormal)" yet
the compiler seems to be trying to convert this to double[]. The AutoCAD
help file describes the last parameter, OCSNormal, as a "Variant
(three-element array of doubles); input-only;optional" which is why I tried
new double[] { 0.0, 0.0, 0.0 }. I need another hint.

thanks


"Paul Richardson" wrote in message
news:6058394@discussion.autodesk.com...
Try System.Type.Missing

"LJB" wrote in message
news:6058315@discussion.autodesk.com...
I'm trying to use Utility.TranslateCoordinates from a C# application. In
VB/VBA I only needed to provide the first four parameters with the fifth
being optional. In C# it seems I must provide all five parameters but I do
not know what to give it as the fifth. Does anyone have any ideas? I'm still
new to .Net/C# and have tried the following:

ActiveDoc.Utility.TranslateCoordinates(
tempPt,
AcCoordinateSystem.acWorld, A
cCoordinateSystem.acUCS,
0,
new double[] { 0.0, 0.0, 0.0 })

ActiveDoc.Utility.TranslateCoordinates(
tempPt,
AcCoordinateSystem.acWorld,
AcCoordinateSystem.acUCS,
0,
null)


thanks
LJB
Message 5 of 6
Anonymous
in reply to: Anonymous

Try this... I didn't test it but it builds.
[code]

object o =
acadApp.ActiveDocument.Utility.TranslateCoordinates
((object) new double[3] {0, 0, 0}, AcCoordinateSystem.acWorld,
AcCoordinateSystem.acUCS, 0, System.Type.Missing);

[/code]





"LJB" wrote in message news:6058411@discussion.autodesk.com...
That doesn't seem to do it. I still get "Cannot implicitly convert type
'object' to 'double[]'". The fifth parameter is declared as type "object" in
"TranslateCoordinates(object Point, AcCoordinateSystem FromCoordSystem,
AcCoordinateSystem ToCoordSystem, int Displacement, object OCSNormal)" yet
the compiler seems to be trying to convert this to double[]. The AutoCAD
help file describes the last parameter, OCSNormal, as a "Variant
(three-element array of doubles); input-only;optional" which is why I tried
new double[] { 0.0, 0.0, 0.0 }. I need another hint.

thanks


"Paul Richardson" wrote in message
news:6058394@discussion.autodesk.com...
Try System.Type.Missing

"LJB" wrote in message
news:6058315@discussion.autodesk.com...
I'm trying to use Utility.TranslateCoordinates from a C# application. In
VB/VBA I only needed to provide the first four parameters with the fifth
being optional. In C# it seems I must provide all five parameters but I do
not know what to give it as the fifth. Does anyone have any ideas? I'm still
new to .Net/C# and have tried the following:

ActiveDoc.Utility.TranslateCoordinates(
tempPt,
AcCoordinateSystem.acWorld, A
cCoordinateSystem.acUCS,
0,
new double[] { 0.0, 0.0, 0.0 })

ActiveDoc.Utility.TranslateCoordinates(
tempPt,
AcCoordinateSystem.acWorld,
AcCoordinateSystem.acUCS,
0,
null)


thanks
LJB
Message 6 of 6
Anonymous
in reply to: Anonymous

The problem wasn't what I expected. I was trying to assign the result of
TranslateCoordinates to a double[] but it returns object which may be cast
to double[]. I have it working now.

thank you for your help

"Paul Richardson" wrote in message
news:6058534@discussion.autodesk.com...
Try this... I didn't test it but it builds.
[code]

object o =
acadApp.ActiveDocument.Utility.TranslateCoordinates
((object) new double[3] {0, 0, 0}, AcCoordinateSystem.acWorld,
AcCoordinateSystem.acUCS, 0, System.Type.Missing);

[/code]





"LJB" wrote in message
news:6058411@discussion.autodesk.com...
That doesn't seem to do it. I still get "Cannot implicitly convert type
'object' to 'double[]'". The fifth parameter is declared as type "object" in
"TranslateCoordinates(object Point, AcCoordinateSystem FromCoordSystem,
AcCoordinateSystem ToCoordSystem, int Displacement, object OCSNormal)" yet
the compiler seems to be trying to convert this to double[]. The AutoCAD
help file describes the last parameter, OCSNormal, as a "Variant
(three-element array of doubles); input-only;optional" which is why I tried
new double[] { 0.0, 0.0, 0.0 }. I need another hint.

thanks


"Paul Richardson" wrote in message
news:6058394@discussion.autodesk.com...
Try System.Type.Missing

"LJB" wrote in message
news:6058315@discussion.autodesk.com...
I'm trying to use Utility.TranslateCoordinates from a C# application. In
VB/VBA I only needed to provide the first four parameters with the fifth
being optional. In C# it seems I must provide all five parameters but I do
not know what to give it as the fifth. Does anyone have any ideas? I'm still
new to .Net/C# and have tried the following:

ActiveDoc.Utility.TranslateCoordinates(
tempPt,
AcCoordinateSystem.acWorld, A
cCoordinateSystem.acUCS,
0,
new double[] { 0.0, 0.0, 0.0 })

ActiveDoc.Utility.TranslateCoordinates(
tempPt,
AcCoordinateSystem.acWorld,
AcCoordinateSystem.acUCS,
0,
null)


thanks
LJB

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost