Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/18/2018 in all areas

  1. You could try my new Multiline Justification program:
    2 points
  2. You could also just dock it.
    1 point
  3. Very very much Thank you @dlanorh For an hour this will serve me well !!! you are the best!!!
    1 point
  4. Typically one constructs a list per iteration, using the cons function, just like in Lee Mac's demo. While append may be used within conditional statements, in order to either append the item into the list or not - simulating a void (void != null) : ; (testappend) >> (0 1 2 4 5) (defun testappend ( / mynewlist ) (foreach x '(0 1 2 3 4 5) (setq mynewlist (append mynewlist (if (/= x 3) (list x)))) ) mynewlist ) ; (testcons) >> (0 1 2 nil 4 5) (defun testcons ( / mynewlist ) (foreach x '(0 1 2 3 4 5) (setq mynewlist (cons (if (/= x 3) x) mynewlist)) ) (reverse mynewlist) ) Its not an advantage, its a requirement! See this. See this. You may use the "like button", this is the facebook of CAD people! Ok, starting simple: MyList >> nil (cons "MyItem" nil) >> ("MyItem") (setq MyList (cons "MyItem" MyList)) >> ("MyItem") (setq MyList (cons "MySecondItem" MyList)) >> ("MySecondItem" "MyItem") (setq MyList (cons "MyThirdItem" MyList)) >> ("MyThirdItem" "MySecondItem" "MyItem") If something doesn't work as you've expected or you don't understand how its working, then build your facts and knowledge upon observations.
    1 point
  5. @Emmanuel sir... Thanks for the lisp... Greatly appreciated... This will help me work fast...(office requirement) and ill use this to my other project as well... This is a weird process but it help me a lot... Maybe to others as well. Kind regards... Cheers
    1 point
  6. OK. Attached is documented Lisp. This works as I expect it to, but you have the final say. Still not sure I am getting the correct block at intermediate vertices. Any problems let me know. plb.lsp
    1 point
  7. Problem solved, had nothing to do with the mouse or software, but with the 2019.1.1 update from autodesk. Problem is fixed in the 2019.1.2 update (don't search for hotfix, it's not available anymore ) The 2019.1.2 updates states this exact problem as fixed.
    1 point
  8. Can you look at the attached dwg and answer the mleadered questions (?) question.dwg
    1 point
  9. Sorry. re "The penny dropped.." is a local english way of saying that i realised what you meant at a later time. I am half way through writing the lisp 1. Is finished and working 2 & 3 are half finished as i am still working on the condition statement for the angles
    1 point
  10. Here's a version where you can choose the justification: (defun c:foo (/ a b c d i o s) ;; RJP » 2018-10-17 (setq c '("Top" "Zero" "Bottom")) (initget "Top Zero Bottom") (setq d (cond ((getkword "\nEnter justification [Top/Zero/Bottom]<Top>:")) ("Top") ) ) (cond ((setq s (ssget ":L" '((0 . "mline")))) (foreach x (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))) (setq o (vlax-ename->vla-object x)) (setq i (vla-get-justification o)) (vla-getboundingbox o 'a z) (setq b a) (vla-put-justification o (vl-position d c)) (vla-update o) (vla-getboundingbox o 'a z) (vla-move o a b) ) ) ) (princ) )
    1 point
  11. Maybe a hack like this .. definitely works with two point mlines: (defun c:foo (/ a b i o s) ;; RJP » 2018-10-17 (cond ((setq s (ssget ":L" '((0 . "mline")))) (foreach x (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))) (setq o (vlax-ename->vla-object x)) (setq i (vla-get-justification o)) (vla-getboundingbox o 'a z) (setq b a) (vla-put-justification o (if (< i 2) (1+ i) 0 ) ) (vla-update o) (vla-getboundingbox o 'a z) (vla-move o a b) ) (sssetfirst nil s) ) ) (princ) )
    1 point
  12. Whilst ronjonp has provide a real good answer I would still look at ignoring what you have and start from scratch and make some draw door routines there are not that many combos, 2 line walls or 4 lines wall etc and the door its self has only 4 combinations left-right, in-out. You start by picking say near an end of a line, nominate offset from say corner then width of door and other wall side then break and draw door.
    1 point
  13. For what it's worth, note that you don't need to 'start the list', as nil is equivalent to an empty list in AutoLISP, and an unbound symbol will similarly evaluate to nil and hence an empty list. As such, your code could be written as: (defun c:test1 ( / mylist mynewlist ) (setq mylist '(0 1 2 3 4 5)) (foreach x mylist (setq mynewlist (append mynewlist (list x))) (print x) ) (setq mynewlist (cdr mynewlist)) ) Testing the above yields the following at the Visual LISP IDE console: _$ (c:test1) 0 1 2 3 4 5 (1 2 3 4 5) Be sure to declare your local variables within the defun expression, otherwise the variables will be considered global and will retain their values within the document namespace (i.e. within the scope of the active drawing) - observe: (defun c:test2 ( ) ;; No local variables - all variables are global! (setq mylist '(0 1 2 3 4 5)) (foreach x mylist (setq mynewlist (append mynewlist (list x))) (print x) ) (setq mynewlist (cdr mynewlist)) ) _$ (c:test2) 0 1 2 3 4 5 (1 2 3 4 5) _$ (c:test2) 0 1 2 3 4 5 (2 3 4 5 0 1 2 3 4 5) Notice how the list contents are repeated for every evaluation (and incorrect values removed by the cdr expression) because the mynewlist variable has retained its value after the function has completed evaluation? For more information on this concept, you may wish to refer to my Localising Variables tutorial. I would also suggest the use of the AutoLISP cons function, as this is both cleaner and more efficient than the append function: (defun c:test3 ( / mylist mynewlist ) (setq mylist '(0 1 2 3 4 5)) (foreach x mylist (setq mynewlist (cons x mynewlist)) (print x) ) (setq mynewlist (cdr (reverse mynewlist))) ) _$ (c:test3) 0 1 2 3 4 5 (1 2 3 4 5) In this case, since elements are 'pushed' onto the front of the list, the list is therefore constructed in reverse and the reverse function is used at the end of the function.
    1 point
  14. (setq l '(0 1 2 3 4 5)) (defun _cdr (l n) (if (> n 0)(cons (nth (1- n) l) (_cdr l (1- n)))) ) (_cdr (reverse l) (1-(length l))) ;(1 2 3 4 5) (_cdr (reverse l) 3 ) ;(3 4 5)
    1 point
  15. Glad to help out . Your other doors get a bit more complicated to check. That's why I suggested some consistency ... dynamic blocks are perfect for this application.
    1 point
×
×
  • Create New...