Recent Posts

Pages: [1] 2 3 ... 10
1
Very cool  8-)
2
AutoLISP (Vanilla / Visual) / Re: How do I filter a list?
« Last post by dubb on Today at 06:00:15 PM »
Awesome! Thank you guys very much. I can understand vl-remove a little better now.
3
AutoLISP (Vanilla / Visual) / Re: How do I filter a list?
« Last post by Lee Mac on Today at 05:25:04 PM »
Whilst by far the easiest method would be to make use of the vl-remove-if function, e.g.:
Code - Auto/Visual Lisp: [Select]
  1. (defun foo1 ( itm lst )
  2.     (vl-remove-if '(lambda ( x ) (member itm x)) lst)
  3. )

There are several other ways to tackle this particular task - for example, using basic iteration:
Code - Auto/Visual Lisp: [Select]
  1. (defun foo2 ( itm lst / rtn )
  2.     (foreach x lst (or (member itm x) (setq rtn (cons x rtn))))
  3.     (reverse rtn)
  4. )

Or recursion:
Code - Auto/Visual Lisp: [Select]
  1. (defun foo3 ( itm lst )
  2.     (if lst
  3.         (if (member itm (car lst))
  4.             (foo3 itm (cdr lst))
  5.             (cons (car lst) (foo3 itm (cdr lst)))
  6.         )
  7.     )
  8. )
4
Hello there,

I used Solidworks to prepare the CAD assembly and then used Keyshot to render this animation (and After Affects to finalise the video)
The experience was very good but it was however very time consuming as I am curious if this would have been achieved easier/faster if I was to use a different CAD software?

https://youtu.be/w6PgUx6LZVM

https://youtu.be/tTK8IfTRuQ0

I am open to feedback and suggestions  :-D

You can see more examples of my work check out my Web-Portfolio:
www.dancabraldesign.com
5
AutoLISP (Vanilla / Visual) / Re: double apostrophe
« Last post by roy_043 on Today at 04:08:01 PM »
I always think of this structure as a form 'complification'. But some programmers seem to love it.
BTW BricsCAD does not accept it.

I donít "love it" but the native form (i.e. raw list via setq or defun-q) of function defs is propagate-able, whereas optimized function defs (via defun) are not. I touch on it briefly here. Cheers.
If you use the double apostrophe syntax there is no symbol to propagate.
6
Hi,
lisp is very simple and is not a problem of search paths, at least I think.
I did some research but I didn't find anything useful on the autodesk site.

It seems that only simple lisp functions work, while vlisp functions that need (vl-load-com) don't work.

Some idea?
https://knowledge.autodesk.com/support/advance-steel/troubleshooting/caas/sfdcarticles/sfdcarticles/Advance-Steel-Documentation-about-LISP-for-Advance-Steel-product.html
7
AutoLISP (Vanilla / Visual) / Re: How do I filter a list?
« Last post by MP on Today at 02:05:11 PM »
Once you get comfortable with the docs youíll realize Iím not. Sorry for the scenic route, I frequently read WAY too fast and think Iíve the gist ...

Cheers.
8
AutoLISP (Vanilla / Visual) / Re: How do I filter a list?
« Last post by dubb on Today at 01:39:42 PM »
You're a genius!
It works!

Here is my failed attempt.
Code: [Select]
(mapcar '(lambda (x)
(if (/= (vl-position "test" (nth x lst)) nil)
     (vl-remove (nth x lst) lst)
     (princ)
   )
)lst)


Thanks!
Wow,  I misunderstood.

Code: [Select]
(vl-remove-if
   '(lambda (x) (member "test" x))
   '(   ("1" "2" "3" "test")   
        ("a" "b" "c" "finished")
        ("a" "b" "c" "test")
    )
)
 

>> (("a" "b" "c" "finished"))

Code: [Select]
(vl-remove-if
   '(lambda (x) (member "finished" x))
   '(   ("1" "2" "3" "test")   
        ("a" "b" "c" "finished")
        ("a" "b" "c" "test")
    )
)
 

>> (("1" "2" "3" "test") ("a" "b" "c" "test"))
9
AutoLISP (Vanilla / Visual) / Re: How do I filter a list?
« Last post by MP on Today at 01:34:27 PM »
Wow,  I misunderstood.

Code: [Select]
(vl-remove-if
   '(lambda (x) (member "test" x))
   '(   ("1" "2" "3" "test")   
        ("a" "b" "c" "finished")
        ("a" "b" "c" "test")
    )
)
 

>> (("a" "b" "c" "finished"))

Code: [Select]
(vl-remove-if
   '(lambda (x) (member "finished" x))
   '(   ("1" "2" "3" "test")   
        ("a" "b" "c" "finished")
        ("a" "b" "c" "test")
    )
)
 

>> (("1" "2" "3" "test") ("a" "b" "c" "test"))

10
AutoLISP (Vanilla / Visual) / Re: How do I filter a list?
« Last post by dubb on Today at 01:29:34 PM »
Like the the function but it only removes the string for me. I want to remove an entire list from the list.

Desired list if "finished" was filtered.

Code: [Select]
(("1" "2" "3" "test")("a" "b" "c" "test"))


If case is not a concern perhaps ...

Code: [Select]
(defun foo ( item-to-remove lst )
    (if (atom (car lst))
        (vl-remove item-to-remove lst)
        (mapcar (function (lambda (x) (foo item-to-remove x))) lst)
    )
)

(foo "test"
   '(   ("1" "2" "3" "test")   
        ("a" "b" "c" "finished")
        ("a" "b" "c" "test")
    )
)

>>

(
    ("1" "2" "3")
    ("a" "b" "c" "finished")
    ("a" "b" "c")
)


Cheers.
Pages: [1] 2 3 ... 10