JustinMeyer Posted September 10, 2009 Share Posted September 10, 2009 (edited) Thanks for looking, any insight or suggestions are greatly appreciated! I have been trying to find the solution for 3 days and can not get it... so now I ask the proffessionals. I am new to objects but have been using Tekla Structures (3D Structural modeling software) for years. With the code below I am able to connect to the process fine, and in other scripts can pull or return information from the model. The problem comes when I try to send information to Tekla. I will explain some of the results after the code. #Region $TSMm = ObjCreate("Tekla.Structures.Model.Model") $TSMgeoP = ObjCreate("Tekla.Structures.Geometry3d.Point") $TSMgeoP2 = ObjCreate("Tekla.Structures.Geometry3d.Point") $TSMuiGD = ObjCreate("Tekla.Structures.Model.UI.GraphicsDrawer") $TSMuiP = ObjCreate("Tekla.Structures.Model.UI.Picker") $TSMuiColor = ObjCreate("Tekla.Structures.Model.UI.Color") #EndRegion ;$oMyError = ObjEvent("AutoIt.Error","MyErrFunc") ;The following line requests that you pick a point in the model ;The variable returns X ($IntPnt.X) Y and Z $IntPnt = $TSMuiP.PickPoint() $String = "X = " & $IntPnt.X & " " & "Y = " & $IntPnt.Y & " " & "Z = " & $IntPnt.Z $Color = $TSMuiColor();black ;This line should draw $String to the active model view at the picked point $TSMuiGD.DrawText($IntPnt, $String, $Color) Func MyErrFunc() $HexNumber=hex($oMyError.number,8) Msgbox(0,"","We intercepted a COM Error !" & @CRLF & _ "Number is: " & $HexNumber & @CRLF & _ "Windescription is: " & $oMyError.windescription & @CRLF & _ "Source is: " & $oMyError.source & @CRLF & _ "Description is: " & $oMyError.description & @CRLF & _ "Helpfile is: " & $oMyError.helpfile & @CRLF & _ "Helpcontext is: " & $oMyError.helpcontext & @CRLF & _ "Lastdllerror is: " & $oMyError.lastdllerror & @CRLF & _ "Scriptline is: " & $oMyError.scriptline) $g_eventerror = 1 Endfunc I know the code is a big mess but I am just trying to get it working before I create anyhting I will share. When I have the object error handler commented out, I get this output in scite: Connecting to Tekla Structures process... Connection succeeded C:\Documents and Settings\jmeyer\Desktop\Tekla\Tekla Obj DrawText.au3 (18) : ==> The requested action with this object has failed.: $TSMuiGD.DrawText($IntPnt, $String, $Color) $TSMuiGD.DrawText($IntPnt, $String, $Color)^ ERROR >Exit code: 1 Time: 3.485 With the error handler on it returns 80070057 as the number and "The parameter is incorrect." for the Windescription This is the code in the tekla help file: public bool DrawText( Point Location, String Text, Color Color ); And an example of usage: drawer.DrawText(new Point(0.0, 1000.0, 1000.0), "TEXT SAMPLE", new Color(1.0, 0.5, 0.0)) The example below was done by someone that uses C#, and it works. IntPnt is the variable that returns from pick point. TSM.UI.Color Color = new TSM.UI.Color(); TSM.UI.GraphicsDrawer Drawer = new Tekla.Structures.Model.UI.GraphicsDrawer(); Drawer.DrawText(IntPnt, "Text Sample", Color); If you need more specific information to help me out just ask. Thanks again! Edited September 11, 2009 by JustinMeyer Link to comment Share on other sites More sharing options...
jvanegmond Posted September 10, 2009 Share Posted September 10, 2009 You might want to say that you're trying to convert C# to AutoIt, instead of C. Now you're attracting the wrong kind of professionals (those that know C), which is on a whole other level. github.com/jvanegmond Link to comment Share on other sites More sharing options...
JustinMeyer Posted September 10, 2009 Author Share Posted September 10, 2009 You might want to say that you're trying to convert C# to AutoIt, instead of C. Now you're attracting the wrong kind of professionals (those that know C), which is on a whole other level.Thanks, fixed. Link to comment Share on other sites More sharing options...
Juvigy Posted September 10, 2009 Share Posted September 10, 2009 Have you tried to change: $Color = $TSMuiColor() to $Color = $TSMuiColor(1.0, 0.5, 0.0) Link to comment Share on other sites More sharing options...
JustinMeyer Posted September 10, 2009 Author Share Posted September 10, 2009 Have you tried to change:$Color = $TSMuiColor()to$Color = $TSMuiColor(1.0, 0.5, 0.0)I have, however by not defining the RGB it defaults to black. And that is not a problem.I am having problems passing the point ($IntPnt) XYZ back to tekla. I have no experience with C#, and thisis the first for me with objects. I am thinking that autoit may handle the ?array? $IntPnt differently thanTekla expects. It is (sort of) an array, I think. $IntPnt.X $IntPnt.Y and $IntPnt.Z all hold vallues. Link to comment Share on other sites More sharing options...
jvanegmond Posted September 10, 2009 Share Posted September 10, 2009 (edited) I have, however by not defining the RGB it defaults to black. And that is not a problem.I am having problems passing the point ($IntPnt) XYZ back to tekla. I have no experience with C#, and thisis the first for me with objects. I am thinking that autoit may handle the ?array? $IntPnt differently thanTekla expects. It is (sort of) an array, I think. $IntPnt.X $IntPnt.Y and $IntPnt.Z all hold vallues.No idea what the problem is here, but I just wanted to point out that $IntPnt holds an object or struct of type Point, not an array, where X and Y and Z are properties (of type double probably). Edited September 10, 2009 by Manadar github.com/jvanegmond Link to comment Share on other sites More sharing options...
JustinMeyer Posted September 10, 2009 Author Share Posted September 10, 2009 No idea what the problem is here, but I just wanted to point out that $IntPnt holds an object or struct of type Point, not an array, where X and Y and Z are properties (of type double probably).Thank you for clearing that up Manadar, and you are correct that $IntPnt.X, $IntPnt.Y and $IntPnt.Z are each double. Link to comment Share on other sites More sharing options...
JustinMeyer Posted September 14, 2009 Author Share Posted September 14, 2009 I have been trying ways of getting this to work with no solution. I have been testing with different types of objects and have come to the conclusion that I am able to request information form the (Tekla) model and or have the user perform an action that returns information. I can not send any data to the model (Tekla Object) though. I would love to solve this. I am open to any suggestions or known issues. Thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now