Results 1 to 3 of 3

Thread: Code Problem!

  1. #1
    Active Member
    Join Date
    2013-03
    Location
    Permian Basin
    Posts
    76
    Login to Give a bone
    0

    Default Code Problem!

    I'm having problems getting this routine to work. The code should allow the user to select two attribute values from the same block then copy those values in a string to some test. For some reason I can not get it to work correctly. For example the user should be able to pick "PIT" then
    "100" from the same block and paste a value of "I-PIT100" into the text. Any help would be greatly appreciated.


    Code:
    (defun c:cblnum ()
    (setq x (car(nentsel "\n Select The First Attribute Value :")))
    (setq y (car(nentsel "\n Select The Second Attribute Value :")))
    (setq ss(car(entsel "\n Select Text :")))
    (setq att1(assoc 1 (entget x)))
    (setq att2(assoc 1 (entget y)))
    (setq stii(strcat (substr "I-" 1 2)(substr att1 1)(substr att2 1)))
    (entmod (subst stii (assoc 1 (entget ss)) (entget ss)))
    (princ)
    )

  2. #2
    All AUGI, all the time
    Join Date
    2015-10
    Location
    Belgrade, Serbia, Europe
    Posts
    564
    Login to Give a bone
    0

    Default Re: Code Problem!

    Code:
    (defun c:cblnum ( / x y ss att1 att2 stii )
      (setq x (car (nentsel "\n Select The First Attribute Value : ")))
      (setq y (car (nentsel "\n Select The Second Attribute Value : ")))
      (setq ss (car (entsel "\n Select Text : ")))
      (setq att1 (cdr (assoc 1 (entget x))))
      (setq att2 (cdr (assoc 1 (entget y))))
      (setq stii (strcat "I-" att1 att2))
      (entmod (subst (cons 1 stii) (assoc 1 (entget ss)) (entget ss)))
      (princ)
    )
    HTH, M.R.

  3. #3
    Active Member
    Join Date
    2013-03
    Location
    Permian Basin
    Posts
    76
    Login to Give a bone
    0

    Default Re: Code Problem!

    Thanks Marko!! I knew it had to be something simple.

Similar Threads

  1. Problem vba code
    By chiab_gigi in forum VBA/COM Interop
    Replies: 10
    Last Post: 2015-02-01, 12:19 PM
  2. Help Please.....Problem With Code
    By CADdancer in forum AutoLISP
    Replies: 9
    Last Post: 2012-07-31, 07:26 PM
  3. Help! A problem with VBA code
    By safar.said235204 in forum VBA/COM Interop
    Replies: 2
    Last Post: 2010-11-28, 08:47 PM
  4. problem loading lisp code
    By mdsalman2003 in forum AutoLISP
    Replies: 14
    Last Post: 2010-06-18, 08:23 PM
  5. Problem with code in VBA
    By DW2Whittle in forum VBA/COM Interop
    Replies: 1
    Last Post: 2008-03-31, 04:13 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
  •