AVAX-software.com Forums: Get coordinates of DXf file - AVAX-software.com Forums

Jump to content

Page 1 of 1

Get coordinates of DXf file how to get the x & y of DXF file in VB^

#1 User is offline   KOKY Icon

  • Newbie
  • Pip
  • Group: Members
  • Posts: 4
  • Joined: 20-November 07

Post icon  Posted 20 November 2007 - 08:50 AM

hi
please help me
i want to know how i get the x, y, z coordinates from the DXF file and save them in arrays
with VB6
thank you

#2 User is offline   Athanasios Gardos Icon

  • Administrator
  • Icon
  • Group: Admin
  • Posts: 333
  • Joined: 21-March 05
  • Gender:Male

Posted 21 November 2007 - 04:09 PM

Please have a look at this topic: finding cordinates
To insert a DXF file you can use function Add_DXF
Athanasios Gardos
Avax-Software.com

#3 User is offline   KOKY Icon

  • Newbie
  • Pip
  • Group: Members
  • Posts: 4
  • Joined: 20-November 07

Posted 29 November 2007 - 08:01 AM

Thank you for your replay
but i still can't get the coordinate of the DXF file in VB6.
i want to take them in arrays, like
the X coordinate saved in e.g. X() array, and
the Y coordinate saved in e.g. Y() array.
in order to use these arrays to get some statisticals.
sorry, i want the code please.

#4 User is offline   Athanasios Gardos Icon

  • Administrator
  • Icon
  • Group: Admin
  • Posts: 333
  • Joined: 21-March 05
  • Gender:Male

Posted 29 November 2007 - 12:14 PM

There is a ready to use function (GetAllNodes) that returns all the different x and y coordinates (not points) in a drawing.
Please, have a look at the following example:
Private Sub Form_Load()
	Dim x() As Single, y() As Single
	Dim lMaxX As Long, lMaxY As Long, lCnt As Long
	Call cAvax1.StartAvax
	Call cAvax1.Add_DXF(App.Path & "\test.dxf", "", 0, 0, 0)
	If cAvax1.GetAllNodes(x(), y()) = True Then
	   lMaxX = UBound(x())
	   Debug.Print "-----X------"
	   For lCnt = 1 To lMaxX
		   Debug.Print x(lCnt)
	   Next lCnt
	   lMaxY = UBound(y())
	   Debug.Print "-----Y------"
	   For lCnt = 1 To lMaxY
		   Debug.Print y(lCnt)
	   Next lCnt
	End If
End Sub

Private Sub Form_Unload(Cancel As Integer)
	Call cAvax1.EndAvax
End Sub

If this is not what you want please let me know.
Athanasios Gardos
Avax-Software.com

#5 User is offline   KOKY Icon

  • Newbie
  • Pip
  • Group: Members
  • Posts: 4
  • Joined: 20-November 07

Posted 02 December 2007 - 08:05 AM

Thank you very much
but this is not what i want
i have a lot of lines in a DXF file, i want to read its endpoints in arrays
e.g X1(), Y1() AND X2(), Y2()
please help me
THANKS

#6 User is offline   Athanasios Gardos Icon

  • Administrator
  • Icon
  • Group: Admin
  • Posts: 333
  • Joined: 21-March 05
  • Gender:Male

Posted 03 December 2007 - 09:27 PM

The following VB6 code returns the line coordinates of a DXF file:

Private Sub Form_Load()
	Dim sDXFFile As String
	Dim iType() As AvaxItemType
	Dim vProp() As Variant
	Dim vData() As Variant
	Dim xyx() As Single
	Dim h() As Long
	Dim lCnt As Long
	Dim x1 As Single, y1 As Single, z1 As Single
	Dim x2 As Single, y2 As Single, z2 As Single
	sDXFFile = App.Path & "\test.dxf"
	Call cAvax1.StartAvax
	If cAvax1.Add_DXF(sDXFFile, "", 0, 0, 0, , , , , h()) = True Then
	   If cAvax1.GetProperties(h(), iType(), vProp(), vData()) = True Then
		  For lCnt = 1 To UBound(h())
			  If iType(lCnt) = Line_i Then
				 xyz() = vData(lCnt)
				 x1 = xyz(1)
				 y1 = xyz(2)
				 z1 = xyz(3)
				 x2 = xyz(4)
				 y2 = xyz(5)
				 z2 = xyz(6)
				 Debug.Print x1, y1, z1, x2, y2, z2 'line coordinates
			  End If
		  Next lCnt
	   End If
	End If
End Sub

Private Sub Form_Unload(Cancel As Integer)
	Call cAvax1.EndAvax
End Sub

Athanasios Gardos
Avax-Software.com

#7 User is offline   KOKY Icon

  • Newbie
  • Pip
  • Group: Members
  • Posts: 4
  • Joined: 20-November 07

Posted 05 December 2007 - 12:01 PM

Dear Athanasios Gardos
thank you very much

Page 1 of 1


Fast Reply

  

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users