insert points ID with coordinates from excel to autocad using vba

insert points ID with coordinates from excel to autocad using vba

ahmed.ongame
Explorer Explorer
2,648 Views
5 Replies
Message 1 of 6

insert points ID with coordinates from excel to autocad using vba

ahmed.ongame
Explorer
Explorer

hi

i want a VBA code that inserts a block in autocad by the coordinates i have from excel and the block should show me the(x , y , z) and point ID of the point block so when i see the point i know which point is which.

if someone can help it will be very helpfull to me and thanks.

0 Likes
2,649 Views
5 Replies
Replies (5)
Message 2 of 6

Ed__Jobe
Mentor
Mentor

To get you started, here is a block in this thread that someone posted. How much experience with vba do you have?

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 3 of 6

ahmed.ongame
Explorer
Explorer

not that much

just some basics i have received from my course in college

i realy want to solve it

i have a file that do this job except the ID part, it is just importing the coordinates


@Ed__Jobewrote:

To get you started, here is a block in this thread that someone posted. How much experience with vba do you have?




 

0 Likes
Message 4 of 6

Ed__Jobe
Mentor
Mentor

This thread shows how to get the xl cell's content.

Use the xl data to build a 3D point object and then use the ThisDrawing.ModelSpace.InsertBlock() method to insert the block. The example in Help shows you how to build a 3 element array of doubles for the point and how to use the InsertBlock method.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 5 of 6

ahmed.ongame
Explorer
Explorer

what i really need is just the insert block method and attrabute with it

0 Likes
Message 6 of 6

Ed__Jobe
Mentor
Mentor

Just be sure to set an object using the insert method. e.g. Here's some quick code.

Dim oIns As AcadBlockReference

Dim oAtts As Variant

Dim i As Integer

oIns = ThisDrawing.Modelspace.InsertBlock 'add args

oAtts =  oIns.GetAttributes

For i =LBound(oAtts) To UBound(oAtts)

   If oAtts(i).TagString = "SomeName" Then

      oAtts(i).TextString = "txtFromXl"

   End If

Next oAtt

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes