+ Reply to Thread
Results 1 to 8 of 8
  1. #1
    Senior Member
    Discipline
    Construction
    wimal's Discipline Details
    Occupation
    cadoperator
    Discipline
    Construction
    Using
    AutoCAD 2016
    Join Date
    Oct 2011
    Location
    sri lanka
    Posts
    496

    Default Why the first code not working

    Registered forum members do not see this ad.

    Code:
    (setq ss nil)
    (if (and (not (initget "Lap"))
              (setq ss (entsel "\nSelect fixed line [Lap length] : ")))
              (if (= "Lap" ss)(progn
               (setq pick "Y")
    	   (setq ss (entsel "\nSelect fixed line  : "))
    	   )))
    2nd code is working

    Code:
    (setq ss nil)
    (if (and (not (initget "Lap"))
              (setq ss (getpoint "\npick point [Lap length] : ")))
              (if (= "Lap" ss)(progn
               (setq pick "Y")
    	   (setq ss (getpoint "\npick point  : "))
    	   )))
    Last edited by wimal; 7th Feb 2018 at 08:18 am. Reason: spell mistake

  2. #2
    Senior Member
    Discipline
    Civil
    Aftertouch's Discipline Details
    Discipline
    Civil
    Details
    Engineer
    Using
    AutoCAD 2017
    Join Date
    Jul 2016
    Location
    Netherlands
    Posts
    287

    Default

    I have never used initget with entsel or getpoint...
    What are you trying to achieve? Im sure there is a simpler way...

  3. #3
    Senior Member
    Discipline
    Construction
    wimal's Discipline Details
    Occupation
    cadoperator
    Discipline
    Construction
    Using
    AutoCAD 2016
    Join Date
    Oct 2011
    Location
    sri lanka
    Posts
    496

    Default

    Quote Originally Posted by Aftertouch View Post
    I have never used initget with entsel or getpoint...
    What are you trying to achieve? Im sure there is a simpler way...
    I need to allow to user to set value of LAP , if user required. Default value is set to 500

  4. #4
    Senior Member
    Discipline
    Civil
    Aftertouch's Discipline Details
    Discipline
    Civil
    Details
    Engineer
    Using
    AutoCAD 2017
    Join Date
    Jul 2016
    Location
    Netherlands
    Posts
    287

    Default

    And you want the user to be able to set the value of LAP... by selecting an entitie and get its length?
    so 'LAP' is 500 OR the length of a selected line?

  5. #5
    Super Member
    Using
    not applicable
    Join Date
    Jun 2016
    Posts
    669

    Default

    Maybe the issue is related to the first letter of the keyword. 'L' has a special meaning when selecting entities: L=Last entity.
    BricsCAD 18

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

    Default

    Here is an example that checks what is picked. Includes L for last which is accepted by entsel.

    Code:
    (defun c:aaa ( / obj)
    (while 
    (setq obj (vlax-ename->vla-object (car (entsel "\nPick objects L for last object"))))
    (cond
    ((= (vla-get-objectname obj) "AcDbLine")(setq len (vla-get-length obj)))
    ((= (vla-get-objectname obj) "AcDbArc")(setq len (vla-get-Arclength obj)))
    ((= (vla-get-objectname obj) "AcDbCircle")(setq len (vla-get-Circumference obj)))
    ((= (vla-get-objectname obj) "AcDbPolyline")(setq len (vla-get-length obj)))
    )
    (if (>  len 0.0)
    (alert (strcat "length is " (rtos len 2 2)))
    (alert "object has no direct length")
    )
    (setq len nil)
    )
    )
    A man who never made mistakes never made anything

  7. #7
    Senior Member satishrajdev's Avatar
    Computer Details
    satishrajdev's Computer Details
    Operating System:
    Windows 7 - 64bit
    Computer:
    DELL
    RAM:
    8 GB
    Primary Storage:
    500 GB
    Monitor:
    DELL
    Discipline
    Surveying
    satishrajdev's Discipline Details
    Occupation
    CAD Engineer
    Discipline
    Surveying
    Details
    Design Survey Utilities (i.e. Bathymetry & Geophysical Survey) Design of Survey Planning. Preparation of Alignment Sheets. Programming in AutoCAD.
    Using
    AutoCAD 2014
    Join Date
    Apr 2012
    Location
    Aamchi Mumbai, India
    Posts
    442

    Default

    Quote Originally Posted by Roy_043 View Post
    Maybe the issue is related to the first letter of the keyword. 'L' has a special meaning when selecting entities: L=Last entity.
    You are right, Its happening because of L stands for Last entity.

    Check out this :
    Code:
    (setq ss nil)
    (if (and (not (initget "LAP"))
    	 (setq ss (entsel "\nSelect fixed line [LAP length] : "))
        )
      (if (= "LAP" ss)
        (progn
          (setq pick "Y")
          (setq ss (entsel "\nSelect fixed line  : "))
        )
      )
    )
    Best Regards,
    Satish Rajdev

    If you ride like there is no tomorrow... Don't worry, there won't be !!!!
    www.facebook.com/satish.rajdev

  8. #8
    Senior Member
    Discipline
    Construction
    wimal's Discipline Details
    Occupation
    cadoperator
    Discipline
    Construction
    Using
    AutoCAD 2016
    Join Date
    Oct 2011
    Location
    sri lanka
    Posts
    496

    Default

    Registered forum members do not see this ad.

    Quote Originally Posted by Roy_043 View Post
    Maybe the issue is related to the first letter of the keyword. 'L' has a special meaning when selecting entities: L=Last entity.
    Yes my friend ,it was the problem. Thanks a lot.

Similar Threads

  1. Autolisp code for working with Imaginary numbers
    By symysgames in forum AutoLISP, Visual LISP & DCL
    Replies: 10
    Last Post: 31st Oct 2016, 10:48 pm
  2. Copy and paste autolisp code not working?
    By CAD Panacea in forum AutoCAD RSS Feeds
    Replies: 0
    Last Post: 28th Jan 2016, 02:30 pm
  3. lisp code not working
    By mhmnibras in forum AutoLISP, Visual LISP & DCL
    Replies: 16
    Last Post: 2nd Mar 2015, 07:57 pm
  4. saveas code not working
    By WPerciful in forum AutoLISP, Visual LISP & DCL
    Replies: 3
    Last Post: 6th Feb 2015, 01:48 pm
  5. Cond.. code is not working
    By bijoyvm in forum AutoLISP, Visual LISP & DCL
    Replies: 3
    Last Post: 27th May 2012, 12:43 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