Jump to content

Help needed to accomplish certain functions


warlock-993

Recommended Posts

Hello Guys

I need help with my project :)

I attached the project so that you can review it and understand what I am asking for :)

So far I managed to make a VBA file that can do the following:

1- allow the user to pick a polyline (a rectangle is the targeted shape).

2- extract the coordinates of the polyline and store them Msflexgrid1.

3- calculate the width and height of the selected rectangle and store them in Msflexgrid2.

4- store the width and height of each selection in Msflexgrid3 in order to export them to .CSV file.

 

What I need help with is:

1- Is it possible to add a label to each selected polyline after selecting it and add it to Msflexgrid2 and Msflexgrid3?

2- Is it possible to make the entire routine works for every polyline in a specified Layer without the need to select each poly individually?

3- how to export Msflexgrid3 to a .CSV file?

 

I know what I am asking for is not easy but my knowledge in VBA is limited and I would appreciate any help provided :)

Thanks a lot in advance :)

Project.rar

Link to comment
Share on other sites

Are you happy to work in lisp you will get more quicker responses. All questions yes can be done.

 

In VBA or lisp ssget function with filters for the required layer, this example is the start code for question 1.

just copy 1 line at a time this example to command line

(setq lay (vla-get-layer (vlax-ename->vla-object (car (entsel "\nPick object for layer")))))
(setq ss (ssget "X" (list (cons 8 lay))))
(alert (strcat "you have " (rtos (sslength ss) 2 0) " items with layer " lay))

Link to comment
Share on other sites

Thanks BIGAL for your quick response.

I actually have zero knowledge about Lisp programming that's why I prefer VBA :D

In addition, I am writing another software using VB6 to use the data that I extract from AutoCAD drawing and having these data extracted using VBA will facilitate the VB6 programming process :)

Again thanks a lot and I really appreciate your help :D:)

Link to comment
Share on other sites

after some work, I was able to accomplish the first and the third question with little modification :)

so now the remaining task is to make it iterate through every poly in the selected layer :D

hope to find some help with this task

thanks all in advance :)

Link to comment
Share on other sites

Vba get selection set with a filter eg Block

 

FilterDXFCode(0) = 0
FilterDXFVal(0) = "INSERT"
Set SS = ThisDrawing.SelectionSets.Add("pit1sel")
SS.Select acSelectionSetAll, , , FilterDXFCode, FilterDXFVal
For Cntr = 0 To SS.Count - 1
If SS.Item(Cntr).Name = Blkname Then

Link to comment
Share on other sites

Thanks BIGAl :)

I was going to mark this thread as Solved as I managed to accomplish all tasks yesterday but I guess it was too late to do so (4 am in my country) :D

I appreciate all the help you provided

Thanks again :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...