Article | 41017038 |
Type | HowTo |
Product | Professional |
Version | 4.0.0.1017 |
Date Added | 3/21/2003 |
Submitted by | Monte Hague (GMSI) |
Keywords |
I wish to draw a line in 3D space. In my words place the vdraw drawing plane in space, then draw the line on that drawing plane. If my drawing plane was positioned with the top left hand corner at (x,y,z) 2,2,2, the top right hand corner at 4,2,2, the bottom left hand corner at 2,0,0, the bottom right hand corner at 4,0,0
^ Y | 2,2,2 4,2,2 | | | | ------------------------ | | | | 2,0,0 4,0,0 _________________________________> X
If I draw a line in this drawing plane then the line generated would be at 2,1,1 to 4,1,1.
Is this possible. Or is there another way of drawing in 3D space?
I would also expect the status bar to show me z coordinates that vary as I move abouth the drawing plane. This does not happen.
How do I position myself(the drawing implement) in 3D space so that I can draw in some plane.
You can do it very easily with code if you use the AddLine method and pass the 2 points (2,1,1) and (4,1,1). See the example below (Command1_Click).
If you want the user to add lines using command action (user input) then it is more complex. You have to go to the CCS you want and there draw the line using cmdLine "USER". See the example below(Command2_Click).
About displaying the World Coordinates see the example below (VDPro1_ChangeCoord code)
Option Explicit Private Sub Command1_Click() ' Draw line(s) from code using AddLine Method Dim MyLine As vdLine VDPro1.ActiveDocument.New Set MyLine = VDPro1.ActiveDocument.Entities.AddLine(Array(2, 1, 1), Array(4, 1, 1)) MyLine.Invalidate VDPro1.CommandAction.Zoom "W", Array(0, 0, 0), Array(5, 5, 0) VDPro1.ActiveDocument.SaveAs App.Path + "\temp.vdf" End Sub Private Sub Command2_Click() ' User drawing line(s) using CmdLine VDPro1.ActiveDocument.New VDPro1.CommandAction.UCS Array(2#, 0#, 0#), Array(4#, 0#, 0#), Array(2#, 2#, 2#) VDPro1.CommandAction.Zoom "W", Array(0, 0, 0), Array(5, 5, 0) VDPro1.CommandAction.CmdLine "USER" VDPro1.ActiveDocument.SaveAs App.Path + "\temp.vdf" End Sub Private Sub Form_Load() 'Show the axis icon VDPro1.ShowWCSAxis = 1 End Sub Private Sub VDPro1_ChangeCoord(ByVal stype As Integer, ByVal x As Double, ByVal y As Double, ByVal z As Double, NewString As String) ' Display World Coordinates always Dim a As Variant a = Array(x, y, z) VDPro1.ActiveDocument.ActiveLayOut.TransPoint a, 2, 0 NewString = "x: " + CStr(a(0)) + " y: " + CStr(a(1)) + " z: " + CStr(a(2)) ' End Sub