Results 1 to 6 of 6

Thread: Modify code help

  1. #1
    I could stop if I wanted to cadd4la's Avatar
    Join Date
    2001-12
    Location
    Newport Beach, CA
    Posts
    351
    Login to Give a bone
    0

    Default Modify code help

    Hello everyone,

    I need help to modify this code so it will run continuously. The code now runs were if I have two or more areas that I need to divide the same distance, I have to start the code, pick one of the areas, and then hit enter, then start the code again. I would like to just be able to pick all the areas one after another and it divide them separate.

    Thanks as always.

    Code:
    (DEFUN C:DIV2()(SETVAR "CMDECHO" 0)
    (SETQ	SS1   (SSGET); Get selection set.
    );_End SETQ
    (COMMAND "DIVIDE" SS1 "2")
    (SETVAR "CMDECHO" 1)
    (princ)
    );
    AutoCAD 2010 Windows7 Ultimate
    _________________________________________________________
    My spelling is wobbly. It's good spelling but it wobbles and the letters get in the wrong places.
    ... Winnie the Pooh

  2. #2
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL
    Posts
    3,181
    Login to Give a bone
    0

    Default Re: Modify code help

    The DIVIDE (Command) creates evenly spaced point objects or blocks along the length or perimeter of an object.
    http://help.autodesk.com/view/ACD/20...3-49EB6378335C
    It doesn't divide areas.
    Tom Beauford P.S.M. - Civil 2019 on Windows 10 Enterprise
    Design Analysis - Leon County Public Works/Engineering Wrap [CODE] tags around selected text
    2280 Miccosukee Rd. Tallahassee, FL 32308-5310
    Ph# (850)606-1516 Home Page

  3. #3
    I could stop if I wanted to cadd4la's Avatar
    Join Date
    2001-12
    Location
    Newport Beach, CA
    Posts
    351
    Login to Give a bone
    0

    Default Re: Modify code help

    Quote Originally Posted by Tom Beauford View Post
    The DIVIDE (Command) creates evenly spaced point objects or blocks along the length or perimeter of an object.
    http://help.autodesk.com/view/ACD/20...3-49EB6378335C
    It doesn't divide areas.
    Tom,

    Thank you for your input and you are right, but I looking for my code to run continuously until I hit escape.

    Cadd4la
    AutoCAD 2010 Windows7 Ultimate
    _________________________________________________________
    My spelling is wobbly. It's good spelling but it wobbles and the letters get in the wrong places.
    ... Winnie the Pooh

  4. #4
    Programming Moderator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,466
    Login to Give a bone
    0

    Default Re: Modify code help

    Your code with a While loop:

    Code:
    (defun c:DIV2 (/ ss)
      (setvar 'cmdecho 0)
      (while (setq ss (ssget ":S:E:L"))
        (command "._divide" ss 2)
      )
      (setvar 'cmdecho 1)
      (princ)
    )
    DIVIDE Command only acts on the first entity in the selection set, so I added a selection filter as well.
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3620, Core i7-7700K 4.2GHz, 64GB RAM, Samsung 970 Pro M.2, 8GB NVIDIA Quadro P4000

  5. #5
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL
    Posts
    3,181
    Login to Give a bone
    0

    Default Re: Modify code help

    About Special Control Characters in Command Macros: http://help.autodesk.com/view/ACD/20...A-BEAEBA83A424
    * Repeats a command until another command is started or the current command is ended.

    Try just adding an asterisk in front of the macro, here's an example: https://forums.autodesk.com/t5/autoc...t/td-p/1996743
    Tom Beauford P.S.M. - Civil 2019 on Windows 10 Enterprise
    Design Analysis - Leon County Public Works/Engineering Wrap [CODE] tags around selected text
    2280 Miccosukee Rd. Tallahassee, FL 32308-5310
    Ph# (850)606-1516 Home Page

  6. #6
    I could stop if I wanted to cadd4la's Avatar
    Join Date
    2001-12
    Location
    Newport Beach, CA
    Posts
    351
    Login to Give a bone
    0

    Default Re: Modify code help

    Blackbox,

    It works great, thank you for your help.

    Cadd4la
    AutoCAD 2010 Windows7 Ultimate
    _________________________________________________________
    My spelling is wobbly. It's good spelling but it wobbles and the letters get in the wrong places.
    ... Winnie the Pooh

Similar Threads

  1. Adding modify data to dxf code
    By mvsawyer in forum AutoLISP
    Replies: 13
    Last Post: 2015-07-17, 06:46 PM
  2. Allow Other Code Compilers for ARX Code
    By IanR in forum AutoCAD Wish List
    Replies: 2
    Last Post: 2013-02-10, 08:06 AM
  3. Modify Floors > Modify Sub Elements
    By diesellam in forum Revit Architecture - General
    Replies: 3
    Last Post: 2010-02-23, 01:53 PM
  4. Insert vbscript code has not code
    By buzz in forum AMEP General
    Replies: 3
    Last Post: 2008-02-09, 03:08 AM
  5. Convert VBA code to VB code
    By Robert Platt in forum VBA/COM Interop
    Replies: 20
    Last Post: 2007-08-15, 10:13 PM

Tags for this Thread

Posting Permissions

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