warlock-993 Posted August 8, 2018 Posted August 8, 2018 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 Quote
BIGAL Posted August 8, 2018 Posted August 8, 2018 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)) Quote
warlock-993 Posted August 8, 2018 Author Posted August 8, 2018 Thanks BIGAL for your quick response. I actually have zero knowledge about Lisp programming that's why I prefer VBA 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 Quote
warlock-993 Posted August 9, 2018 Author Posted August 9, 2018 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 hope to find some help with this task thanks all in advance Quote
BIGAL Posted August 10, 2018 Posted August 10, 2018 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 Quote
warlock-993 Posted August 10, 2018 Author Posted August 10, 2018 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) I appreciate all the help you provided Thanks again Quote
BIGAL Posted August 11, 2018 Posted August 11, 2018 Good to here a lot of VL code syntax can be converted to VBA. Quote
Recommended Posts
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.