+ Reply to Thread
Results 1 to 8 of 8
  1. #1
    Junior Member
    Using
    AutoCAD 2007
    Join Date
    Jun 2016
    Posts
    23

    Default Help needed to accomplish certain functions

    Registered forum members do not see this ad.

    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

  2. #2
    Quantum Mechanic BIGAL's Avatar
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    10,792

    Default

    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
    Code:
    (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))
    A man who never made mistakes never made anything

  3. #3
    Junior Member
    Using
    AutoCAD 2007
    Join Date
    Jun 2016
    Posts
    23

    Default

    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

  4. #4
    Junior Member
    Using
    AutoCAD 2007
    Join Date
    Jun 2016
    Posts
    23

    Default

    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

  5. #5
    Quantum Mechanic BIGAL's Avatar
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    10,792

    Default

    Vba get selection set with a filter eg Block

    Code:
    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
    A man who never made mistakes never made anything

  6. #6
    Junior Member
    Using
    AutoCAD 2007
    Join Date
    Jun 2016
    Posts
    23

    Default

    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

  7. #7
    Junior Member
    Using
    AutoCAD 2007
    Join Date
    Jun 2016
    Posts
    23

    Default [Solved] Help needed to accomplish certain functions

    Thanks every one

  8. #8
    Quantum Mechanic BIGAL's Avatar
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    10,792

    Default

    Registered forum members do not see this ad.

    Good to here a lot of VL code syntax can be converted to VBA.
    A man who never made mistakes never made anything

Similar Threads

  1. How do I accomplish this rotation?
    By oftenly in forum AutoCAD 2D Drafting, Object Properties & Interface
    Replies: 24
    Last Post: 16th Feb 2017, 07:50 am
  2. I don't completely understand what I need to accomplish with this.
    By StudentOfComputers in forum Student Project Questions
    Replies: 4
    Last Post: 22nd Oct 2014, 11:31 pm
  3. Help with vlr functions.
    By Costinbos77 in forum AutoLISP, Visual LISP & DCL
    Replies: 2
    Last Post: 6th Nov 2012, 03:35 pm
  4. vla Functions
    By Costinbos77 in forum AutoLISP, Visual LISP & DCL
    Replies: 12
    Last Post: 6th Nov 2012, 01:59 pm
  5. Two useful functions
    By Derrick022 in forum Civil 3D & LDD
    Replies: 1
    Last Post: 23rd Feb 2012, 03:55 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts