Jump to content

Recommended Posts

Posted
I don't understand why append is unnecessary. How is it going to be a part of the list?

 

Because the expression is being passed as an argument to the list function; your append expression will merely return the supplied argument:

_$ (append '(1 2 3))
(1 2 3)

  • Replies 45
  • Created
  • Last Reply

Top Posters In This Topic

  • Lee Mac

    19

  • ksperopoulos

    17

  • broncos15

    7

  • BlackBox

    3

Posted

I know you are probably right Lee, but I can't figure out how. It works correctly when I have the append function but I keep getting errors when I try to add the variable laydesc to the list function.

Posted

e.g.:

(regapp "AcAecLayerStandard")
(entmake
   (list
      '(0 . "LAYER")
      '(100 . "AcDbSymbolTableRecord")
      '(100 . "AcDbLayerTableRecord")
       (cons 2 layname)
       (cons 6 layltype)
       (cons 62 laycolor)
       (cons 70 laystatus)
       (cons 290 layplot)
       (cons 370 laylwt)
       laydesc
   )
)

Posted

Lee - that is exactly what I did. Like I mentioned before, this subfunction to create a layer is being used by another main function. Maybe there is something in the rest of the main function's code that is messing it up (although I can't imagine what). In my earlier post, I gave the variables I am passing to this subfunction as well as the whole subfunction itself.

Posted
Lee - that is exactly what I did. Like I mentioned before, this subfunction to create a layer is being used by another main function. Maybe there is something in the rest of the main function's code that is messing it up (although I can't imagine what). In my earlier post, I gave the variables I am passing to this subfunction as well as the whole subfunction itself.

 

Are you relying on global variables, or are you passing the variable values as arguments to your subfunction? If the former, many of the variable names in your earlier post do not match those used in your entmake expression.

Posted

I have localized the variables within my main function and not in the subfunction. I think I am passing the variables to the subfunction as expressions. I am not localizing the variables within the subfunction. (Sorry for the different variable names. I decided to make it a little more descriptive for me. They are the same in both the main and subfunctions though.) Here are some updated parts of my code:

 

Main Function:

(defun c:MEPELEV ( / layname layltype laycolor laystate layplot laylweight laydesc )
   (setq layname "G-ANNO-ELEV"
        layltype "Continuous"
        laycolor 7
        laystate 0
         layplot 1
      laylweight 25
         laydesc '(-3 ("AcAecLayerStandard" (1000 . "") (1000 . "Elevation Tags")))
   )

......yadda yadda yadda

)

 

Subfunction:

(defun CreateLayer ( )
   (regapp "AcAecLayerStandard")
   (entmake (list '(0 . "LAYER")
                  '(100 . "AcDbSymbolTableRecord")
                  '(100 . "AcDbLayerTableRecord")
                   (cons 2 layname)
                   (cons 6 layltype)
                   (cons 62 laycolor)
                   (cons 70 laystate)
                   (cons 290 layplot)
                   (cons 370 laylweight)
                   (append laydesc)
             )
   )
)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...