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
    399
    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)
    );

  2. #2
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,667
    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.

  3. #3
    I could stop if I wanted to cadd4la's Avatar
    Join Date
    2001-12
    Location
    Newport Beach, CA
    Posts
    399
    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

  4. #4
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    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 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  5. #5
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,667
    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

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

    Default Re: Modify code help

    Blackbox,

    It works great, thank you for your help.

    Cadd4la

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 autocad.wishlist1734 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
  •