+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 16
  1. #1
    Full Member
    Using
    Architecture 2014
    Join Date
    Sep 2013
    Posts
    33

    Default Variable Not Passing Contents?

    Registered forum members do not see this ad.

    In the code below for some reason the constlist2 is not passing it's contents to the layer command. It is setting the variable correctly when I check it, so I am not sure where the issue lies. If you would like to test the code first type in the command line (setq CurLevel 2). This will establish what level you are on and change the 1 in the layer names to a 2.

    Code:
    (setq constlist "*1-WALL-*,*1-PLUM-FX-*,*1-STRT-*")
    (setq conaddlay "*-CLAD-*")
    
    (Defun constmode (/ n) 
    		(setq constlist2 (vl-string-translate "1" (itoa CurLevel) constlist))
    		(command "-LAYER" "T" constlist2 "T" conaddlay "ON" constlist2 "ON" conaddlay "U" constlist2 "U" conaddlay "")
    )

  2. #2
    Super Member marko_ribar's Avatar
    Computer Details
    marko_ribar's Computer Details
    Operating System:
    Windows 7 Ultimate X64
    Computer:
    Intel quad core CPU 4x2.66GHz, 8GB RAM
    Motherboard:
    INTEL compatibile
    CPU:
    quad core 4x2.66GHz
    RAM:
    8GB
    Graphics:
    NVIDIA GeForce 6600 GT
    Primary Storage:
    250 GB
    Secondary Storage:
    500 GB
    Monitor:
    Samsung 17''
    Discipline
    Architectural
    marko_ribar's Discipline Details
    Occupation
    Architecture, project designer, project visualisation
    Discipline
    Architectural
    Details
    space design - modeling and animations
    Using
    AutoCAD 2014
    Join Date
    Feb 2010
    Location
    Belgrade, Serbia, Europe
    Posts
    1,216

    Default

    Layer names can't have * character... Try to create layer "*1-WALL-*" and you'll see that that's impossible...

    Marko Ribar, d.i.a. (graduated engineer of architecture)
    M.R. on YouTube

  3. #3
    Full Member
    Using
    Architecture 2014
    Join Date
    Sep 2013
    Posts
    33

    Default

    If I type in or write out the list that way it works fine. The * are not in the name but are wildcards, so that if there is anything in front or behind it will still catch it.

  4. #4
    Super Member marko_ribar's Avatar
    Computer Details
    marko_ribar's Computer Details
    Operating System:
    Windows 7 Ultimate X64
    Computer:
    Intel quad core CPU 4x2.66GHz, 8GB RAM
    Motherboard:
    INTEL compatibile
    CPU:
    quad core 4x2.66GHz
    RAM:
    8GB
    Graphics:
    NVIDIA GeForce 6600 GT
    Primary Storage:
    250 GB
    Secondary Storage:
    500 GB
    Monitor:
    Samsung 17''
    Discipline
    Architectural
    marko_ribar's Discipline Details
    Occupation
    Architecture, project designer, project visualisation
    Discipline
    Architectural
    Details
    space design - modeling and animations
    Using
    AutoCAD 2014
    Join Date
    Feb 2010
    Location
    Belgrade, Serbia, Europe
    Posts
    1,216

    Default

    Why don't you make list of real layer names that are in DWG, based on * filters using (wcmatch) function and pass that list to layer command...

    Marko Ribar, d.i.a. (graduated engineer of architecture)
    M.R. on YouTube

  5. #5
    Full Member
    Using
    Architecture 2014
    Join Date
    Sep 2013
    Posts
    33

    Default

    I want to try and avoid writing the same thing 30 + times like I am doing now. Which is a pain in the but when you want to and a new layer type. I have a bunch of commands that I am calling that would utilize this function. Making things a lot simpler to edit.

    Our drawings consist of a base file which contains anything that does not change from elevation to elevation in full 3d (we have multiple fronts for each house). The fronts are xrefs along with any options that we want to add that may be in the base portion of the house. The program I have put together (with a lot of help from you wonder people) filters through and turns on the right stuff based on the command you call. If I call command FRELE it prompts for which elevation letter I want to see. Say I select B. Now it will display only the base house and anything pertaining to the B elevation when a I call my mode commands. So if I call L1E it will take me to my first floor electrical. Or say I want to go to my construction drawing on the 2nd floor. Type L2 and it will make all the right stuff visible and turn everything else off.

    Hope that helps shed a little more light on what I am doing.

  6. #6
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    19,322

    Default

    Nothing immediately jumps out as wrong when looking over your posted code - could you possibly post the command-line output when running the program to demonstrate the problem you are receiving?
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

  7. #7
    Full Member
    Using
    Architecture 2014
    Join Date
    Sep 2013
    Posts
    33

    Default

    Below is the command where I call the constmode function. When I call this command it returns nil.

    Code:
    (Defun C:L1 ()  (L1))
    (Defun L1 () 	(setq CurLevel 1)
    		(alllayoff)
    		(constmode)
    		(filterelev)
    		(command-s "elevation" FL1)
    		(command-s "Osnapz" "1")
     		(AecSetLayerKeyOverride "LEVEL" "1")
    		(command-s "-AECDisplayConfigSetCurrent" "1")
    		(mainxref)
    		(regenerate)
    )
    But if I substitute the following code in place of the constmode function everything works seamlessly.

    Code:
    (command-s "-LAYER" "T" "*1-WALL-*,*1-PLUM-FX-*,*1-STRT-*,*-CLAD-*" "ON" "*1-WALL-*,*1-PLUM-FX-*,*1-STRT-*,*-CLAD-*" "U" "*1-WALL-*,*1-PLUM-FX-*,*1-STRT-*,*-CLAD-*" "" "")

  8. #8
    Super Member marko_ribar's Avatar
    Computer Details
    marko_ribar's Computer Details
    Operating System:
    Windows 7 Ultimate X64
    Computer:
    Intel quad core CPU 4x2.66GHz, 8GB RAM
    Motherboard:
    INTEL compatibile
    CPU:
    quad core 4x2.66GHz
    RAM:
    8GB
    Graphics:
    NVIDIA GeForce 6600 GT
    Primary Storage:
    250 GB
    Secondary Storage:
    500 GB
    Monitor:
    Samsung 17''
    Discipline
    Architectural
    marko_ribar's Discipline Details
    Occupation
    Architecture, project designer, project visualisation
    Discipline
    Architectural
    Details
    space design - modeling and animations
    Using
    AutoCAD 2014
    Join Date
    Feb 2010
    Location
    Belgrade, Serbia, Europe
    Posts
    1,216

    Default

    But does function (constmode) performs what should - displaying of layer states changes as desired?

    If that's so, then only thing you should do to avoid nil prompt is to add (princ) at the end of (constmode) function...

    If that isn't so, perhaps you may consider putting those setqs before (constmode) inside (constmode), right?
    Last edited by marko_ribar; 27th Oct 2013 at 06:30 am.

    Marko Ribar, d.i.a. (graduated engineer of architecture)
    M.R. on YouTube

  9. #9
    Full Member
    Using
    Architecture 2014
    Join Date
    Sep 2013
    Posts
    33

    Default

    I have tried that also and that does not fix it. I have all of my variables that I may use in a field or in some other way initializing at start up so that all of my tables can read the data correctly.

  10. #10
    Full Member
    Using
    Architecture 2014
    Join Date
    Sep 2013
    Posts
    33

    Default

    Registered forum members do not see this ad.

    Any ideas???

Similar Threads

  1. Passing arguments to a function
    By samifox in forum AutoLISP, Visual LISP & DCL
    Replies: 12
    Last Post: 10th Mar 2013, 07:16 pm
  2. Question about passing field or variable to plugin
    By keith6226 in forum AutoCAD General
    Replies: 0
    Last Post: 18th Oct 2011, 04:36 am
  3. Passing variables between functions
    By nzgeocad in forum AutoLISP, Visual LISP & DCL
    Replies: 1
    Last Post: 16th Aug 2009, 11:29 pm
  4. Passing variables from VBA to Lisp
    By TomJandro in forum AutoLISP, Visual LISP & DCL
    Replies: 0
    Last Post: 14th Aug 2009, 12:49 pm
  5. Passing data to table field
    By Impala62 in forum AutoLISP, Visual LISP & DCL
    Replies: 10
    Last Post: 13th Mar 2008, 05:06 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