Jump to content
warlock-993

Help needed to accomplish certain functions

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

Share this post


Link to post
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))

Share this post


Link to post
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:)

Share this post


Link to post
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 :)

Share this post


Link to post
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

Share this post


Link to post
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 :)

Share this post


Link to post
Share on other sites

Good to here a lot of VL code syntax can be converted to VBA.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×