Error when executing Lisp file

HI,

I found a 3d stretch lisp file online and I loaded it through Appload command, but when I go to run it this error message comes up "error : system variable not available : subobjselectionmode" I dont know much about lisp and resolving these types of errors. Any help would be appreciated. Thanks!

Comments

  • Hi Eric, where did you find the code?

  • cadstudio

  • Apparently, this is the code:

    ;3Dstretch - stretch 3D model's faces in any direction
    ;CAD Studio, 2017 - www.cadstudio.cz  www.cadforum.cz
    
    (defun C:3DSTRETCH (/ cmde sosm ss wp1 wp2 sp1 sp2)
    
     (setq cmde (getvar "cmdecho"))
     (setvar "cmdecho" 0)
     (setq sosm (getvar "subobjselectionmode"))
     (setvar "subobjselectionmode" 3)
     (princ "\nWindow-select faces to stretch")
     (and 
      (setq wp1 (getpoint "\nPick the first window corner: "))
      (setq wp2 (getcorner wp1 "\nPick the second window corner: "))
      (setq ss (ssget "_W:V" wp1 wp2))
      (not (command "_SELECT" ss ; simulated
        (setq sp1 (getpoint "\nPick the first 3Dstretch point (from) or <displacement>: "))
        (if sp1
         (setq sp2 (getpoint sp1 "\nPick the second 3Dstretch point (to): "))
         (setq sp1 '(0 0 0)  sp2 (getpoint sp1 "\nSpecify displacement <0.0,0.0,0.0>: "))
        )
        (if (not sp2) (setq sp2 sp1))
        nil)) ; cancel it
      (command
        "_move" ss ""
        sp1 sp2
        "_stretch"
        "_c" wp1 wp2
        "_r" "_p" ""
        sp1 sp2
      )
     )
     (setvar "subobjselectionmode" sosm)
     (setvar "cmdecho" cmde)
     (princ)
    )
    

    A workaround for selecting faces could be setting selectionmodes to 2, but pressing ctrl to prevent selecting solids does not work off course. I am really curious if someone else knows a solution.

    By the way, should (ssget "W:V" ...) be supported?

  • I checked the code with mine and yes it is the same.

    Thanks for looking into this for me.

  • Maybe there is no need for Lisp code. Depending on the license the _DmMove command can be used.

  • Thanks Roy!

    It took me a while to figure out but it seems to work. I need to press "ctrl." before I finalize the selection window.