Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Command, vl-cmdf and command-s Autocad 2015

  1. #1
    Member
    Join Date
    2009-03
    Posts
    39
    Login to Give a bone
    0

    Default Command, vl-cmdf and command-s Autocad 2015

    Hi,

    If ListPoints is a list of points and R is a distance,

    with Autocad2015:

    Case 1:
    Code:
    (mapcar '(lambda (pt) (command "_circle" pr R)) ListPoints)
    returns: VVC: Internal Error

    Case 2:
    Code:
    (mapcar '(lambda (pt) (vl-cmdf "_circle" pr R)) ListPoints)
    returns: VVC: Internal Error

    Case 3:
    Code:
    (mapcar '(lambda (pt) (command-s "_circle" pr R)) ListPoints)
    Works Ok.

    With Autocad2013 case 1 and case 2 work Ok. Why not now?

    Command-s can avoid problems, but... if the order was:

    Code:
    (mapcar '(lambda (pt) (vl-cmdf "_pline" pt)) ListPoints)
    command-s doesn't generate a single pline.
    Last edited by BlackBox; 2015-01-30 at 01:14 PM. Reason: Please use [CODE] Tags

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

    Default Re: Command, vl-cmdf and command-s Autocad 2015

    Kean's AutoCAD 2015: calling commands article may be able to provide some clarification... Put simply the ObjectARX functions were modified, which LISP is ultimately dependent on, and despite Autodesk generally handling which new 'correct' ARX call to make in the LispFunction code-behind, without changing the calling LISP, there are instances where Command-s is needed as you're already aware.

    Cheers
    "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

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

    Default Re: Command, vl-cmdf and command-s Autocad 2015

    Also, FWIW -

    Code:
    (vl-load-com)
    
    (defun _MakeCircles (doc points radius / oSpace circles)
      (setq oSpace (vlax-get doc
                             (if (= 1 (getvar 'cvport))
                               'paperspace
                               'modelspace
                             )
                   )
      )
      (foreach pt points
        (setq circles
               (cons (vla-addcircle oSpace (vlax-3d-point pt) radius)
                     circles
               )
        )
      )
      (reverse circles)
    )
    "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

  4. #4
    All AUGI, all the time
    Join Date
    2010-06
    Posts
    962
    Login to Give a bone
    0

    Default Re: Command, vl-cmdf and command-s Autocad 2015

    To work with entmake(x) is much better than the use of command calls specially in lisps .

    Code:
    (mapcar '(lambda (pt) (entmake (list '(0 . "CIRCLE") (cons 10 pt) (cons 40 R)))) ListPoints)

  5. #5
    Member
    Join Date
    2009-03
    Posts
    39
    Login to Give a bone
    0

    Default Re: Command, vl-cmdf and command-s Autocad 2015

    Thank you, Tharwat, I will use your idea. I love plain Lisp.

    But the main question is not how to draw circles but why suddenly command, vl-cmdf don't work. I have lot of codes, and I have never hadd problems with new autocad versions, i don't understand why now.

    By the way, how can I solve the problema with the pline?

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

    Default Re: Command, vl-cmdf and command-s Autocad 2015

    Quote Originally Posted by l3ch View Post
    I love plain Lisp.
    I opt for Visual LISP for ease of supporting UNDO functionality, which 'plain LISP' can only accomplish with Command calls, or to use Visual LISP for the UNDO portion, in which case you'd just use same in the first place. Also, with any 'current' workstation, 'plain LISP' doesn't have any real, demonstrable difference in performance for end user, as is not as 'plain' to read (DXF has always been cheeky that way).


    Quote Originally Posted by l3ch View Post
    But the main question is not how to draw circles but why suddenly command, vl-cmdf don't work. I have lot of codes, and I have never hadd problems with new autocad versions, i don't understand why now.
    Please read Kean's article, linked above.


    Quote Originally Posted by l3ch View Post
    By the way, how can I solve the problema with the pline?
    Code:
    (vl-load-com)
    
    (defun _AddPolyline (doc points)
      ;; Example: (_AddPolyline acDoc listPoints)
      (if (= (rem (length (setq points (apply 'append points))) 3) 0)
        (vla-addpolyline
          (vlax-get doc
                    (if (= 1 (getvar 'cvport))
                      'paperspace
                      'modelspace
                    )
          )
          (vlax-safearray-fill
            (vlax-make-safearray
              vlax-vbDouble
              (cons 0 (- (length points) 1))
            )
            points
          )
        )
      )
    )


    Cheers
    "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

  7. #7
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,109
    Login to Give a bone
    0

    Default Re: Command, vl-cmdf and command-s Autocad 2015

    I noticed in your lambda expression(at the top) you have the argument (pt) but in the expression you have a variable pr

    This is what I see above.

    Code:
    (mapcar '(lambda (pt) (vl-cmdf "_circle" pr R)) ListPoints)
    Try

    Code:
    (mapcar '(lambda (pt) (vl-cmdf "_circle" PT R)) ListPoints)
    Worked for me.

    P=
    AutomateCAD

  8. #8
    Member
    Join Date
    2009-03
    Posts
    39
    Login to Give a bone
    0

    Default Re: Command, vl-cmdf and command-s Autocad 2015

    Thanks, Peter, it was a misprint. I thought everybody caught the idea and I didn't want to add another message with the correction. I apologize for any inconveniences.

  9. #9
    Member
    Join Date
    2009-03
    Posts
    39
    Login to Give a bone
    0

    Default Re: Command, vl-cmdf and command-s Autocad 2015

    Thanks, BlackBox. Kean'sarticle was hard for me, but I get the idea. Is a matter of fact, Autocad2015.

    Thanks again for your code with the pline solution.

    I have rewritten my codes, where I used (mapcar '(lambda... with lots of commands and so, I have created small subroutines (like _AddPolyline).

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

    Default Re: Command, vl-cmdf and command-s Autocad 2015

    Quote Originally Posted by l3ch View Post
    Thanks, BlackBox. Kean'sarticle was hard for me, but I get the idea. Is a matter of fact, Autocad2015.

    Thanks again for your code with the pline solution.

    I have rewritten my codes, where I used (mapcar '(lambda... with lots of commands and so, I have created small subroutines (like _AddPolyline).
    You're welcome, l3ch; reading Kean's (and others') articles gets easier the more you understand.

    As Peter aptly demonstrated, there's nothing wrong with the Command version either. To my mind it's more about using the right method for any given task, so as a small example, you could not use the command option in a ObjectDBX batch process, whereas you could use my offering, but you're unlikely to perform a batch process often.

    Hope this makes (more?) sense.

    Cheers
    "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

Page 1 of 2 12 LastLast

Similar Threads

  1. 2007: Publish Command says unknown command in autocad 2007
    By drajappa594109 in forum AutoCAD General
    Replies: 2
    Last Post: 2012-07-13, 03:34 PM
  2. Replies: 6
    Last Post: 2007-04-23, 01:40 AM
  3. AutoCAD LT 2007 Appload command returns - unknown command
    By tbedrich in forum AutoCAD LT - General
    Replies: 3
    Last Post: 2007-04-10, 02:09 PM
  4. Replies: 4
    Last Post: 2006-05-09, 08:57 PM
  5. Replies: 8
    Last Post: 2005-06-30, 02:32 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
  •