Results 1 to 4 of 4

Thread: Problem having command repeat until escaped with VB.Net

  1. #1
    Member
    Join Date
    2011-10
    Posts
    39
    Login to Give a bone
    0

    Default Problem having command repeat until escaped with VB.Net

    I am converting over a menu to a palette. An example menu macro command being moved over is *^C^C(command "layer" "m" "LSYMLIN" "ltype" "continuous" "" "color" "30" "" "")(command "insert" "104" "S" msf "r" 0 (getpoint)); As I understand the * in front of the macro is what tells the command to continue to repeat until the user no longer wants it, this works perfectly in the menu. The users is asked to select and insertion point on the screen, it inserts the symbol, asks the user for an insertion point, inserts the symbol and so on. However when moving this over to .Net I can't get the repeat functionality to function the same. I am currently doing something along the lines of

    Dim command As String = "(command ""layer"" ""m"" ""LSYMLIN"" ""ltype"" ""continuous"" """" ""color"" ""30"" """" """")(command ""insert"" ""104"" ""S"" msf ""r"" 0 (getpoint)) "
    ThisDrawing.SendCommand(command)

    I have tried using the Multiple command first with no luck (it asks for the first point, inserts it, asks for the next point but doesn't do anything when you select the point). There is a screenshot of this attached (the block name is different on the screenshot but the rest of the command is the same). It inserted the block once, and you can see it asking for the insertion point again, however when I click nothing happens!
    Attached Images Attached Images

  2. #2
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,397
    Login to Give a bone
    0

    Default Re: Problem having command repeat until escaped with VB.Net

    SendCommand runs asynchronously.
    C:> ED WORKING....

  3. #3
    Member
    Join Date
    2010-08
    Posts
    40
    Login to Give a bone
    0

    Default Re: Problem having command repeat until escaped with VB.Net

    Well personally i'd handle that with LISP, something simple along the lines of:

    Code:
    (defun c:yourcommandhere ()
      (while (= 1 (getvar "cmdactive"))
        (command yourcommandstringhere)
        )
      )
    but then the looping may not work as intended, so for .NET, try enclosing your commands like this?
    Code:
     Dim LoopControl As Boolean = True
            Do While LoopControl
                Using tr As Transaction = db.TransactionManager.StartTransaction()
                    "your command strings here"
                    If pr.Status = PromptStatus.Cancel Then Exit Do
                    If pr.Status = PromptStatus.OK Then
                End Using
            Loop

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

    Default Re: Problem having command repeat until escaped with VB.Net

    It's been a while since this thread was started, but if I might ask, why use VB.NET to access COM, to send a Command string via SendCommand() in lieu of simply accessing the .NET API straight on?

    Seems like an awful lot of work, when a simple LISP could do the same. Just saying.
    "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

Similar Threads

  1. Repeat Last Command
    By gmg in forum Revit - Platform
    Replies: 4
    Last Post: 2013-04-20, 10:29 PM
  2. Repeat last command
    By revit.wishlist1942 in forum Revit Architecture - Wish List
    Replies: 1
    Last Post: 2013-01-04, 05:39 PM
  3. Command alias repeat on the command line
    By rbilger in forum AutoCAD General
    Replies: 8
    Last Post: 2011-08-18, 09:47 PM
  4. repeat command
    By Ning Zhou in forum Revit Architecture - General
    Replies: 2
    Last Post: 2009-12-14, 07:59 PM
  5. Repeat last command issue
    By robert.1.hall72202 in forum AutoCAD General
    Replies: 3
    Last Post: 2006-01-11, 02:12 PM

Posting Permissions

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