TheSwamp
Code Red => VB(A) => Topic started by: orcan on April 26, 2015, 05:08:04 AM
-
Hi all
İ am trying to auto calculate weights of certain dxf drawings by autocad but it seems impossible so far.
Now i am thinking about a new scenario like getting coordinates of lines , circles etc from autocad
then re-draw em on catia.
so could you please tell me a way for geeting start and end point coordinates of lines from autocad to excel.
thx in advance
-
My method of choice these days, working on 64-bit Autocad 2015 and 32-bit Excel 2010, while using VBA, is to:
- Build a selection set (or a series of if-then loops), I find the selection sets in 64-bit VBA to be iffy at best
- once you have the items you want write a comma delimited text file
- import that to excel
It isn't the cleanest method by any means but is more bulletproof for me, on my box, that trying something fancier.
I can give you an example later in the day.
-
Here is a brute force method, not a speed demon but it is reliable if you let it sit and cook
With a reference to the "Microsoft Scripting Runtime"
Public Sub BruteForceTriangles()
Dim txtstream As TextStream
Dim fso As New FileSystemObject
Dim face As Acad3DFace
Dim myfile As String
Dim acent As AcadEntity
On Error GoTo MyExit
myfile = "C:\GDrive\AutoCAD\HLB-Lime.txt"
Set txtstream = fso.OpenTextFile(myfile, ForWriting, True)
For Each acent In ThisDrawing.ModelSpace
If acent.ObjectName = "AcDbFace" Then
Set face = acent
If face.Layer = "0-HLB-LimeArea" Then
txtstream.WriteLine face.Coordinates(0) & "," & face.Coordinates(1) & "," & face.Coordinates(2) & "," & face.Coordinates(3) & "," & face.Coordinates(4) & "," & face.Coordinates(5) & "," & face.Coordinates(6) & "," & face.Coordinates(7) & "," & face.Coordinates(8)
End If
End If
Next acent
MyExit:
txtstream.Close
End Sub
-
Hey swift
Thx for your reply
i will give it a try and share the result.
Cheers!
-
We are looking for AutoCad VBA consultant. We developed a Visual Basic plug-in for AutoCad, which works well on AutoCad 12 WindowsXP. AutoCad limited the Visual Basic support for AutoCad 13 (maybe 14 as well), but re-introduced for AutoCad 2015. We need some VBA programming support for our AutoCad plug-in for 64-bit Windows 7 and AutoCad 15+.
Please contact me.
Mark
Universe Technical Translation, Inc.
mark@universe.us
713-8278800