See the top rated post in this thread. Click here

Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Simplify our life...

  1. #1
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,109
    Login to Give a bone
    2

    Default Simplify our life...

    If you were to simplify Visual LISP what functionality would you add?

    Many of the most repetitive routines should be added and we can do that with an open source lisp file.

    If any of you have any idea's I can compile and maintain them.

    like I shared "shortfunctions.lsp" file a week or so ago that makes getting and putting properties a breeze.

    I am working on adding other functionality to it.

    Like these two functions

    (toobject is in the shortfunctions.lsp file or can be removed if you always pass a vla-object to these functions.)

    Code:
    (defun BlockDefinition (obj)
     (if (and
          (setq obj (toobject obj))
          (wcmatch (vla-get-objectname obj) "AcDbBlockReference,AcDbMInsertBlock")
         )
      (vla-item (blocks (document obj)) (effectivename obj))
     )
    )
    
    (defun CollectionToList (colItems / lstReturn)
     (if (and 
          (setq colItems (toobject colItems))
          (vlax-method-applicable-p colItems "ITEM")      
          (vlax-map-collection colItems '(lambda (X)(setq lstReturn (cons X lstReturn))))
         )
      (reverse lstReturn)
     )
    )
    AutomateCAD

  2. #2
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,804
    Login to Give a bone
    0

    Default Re: Simplify our life...

    I'm not trying to compare or judge one or the other, but there are a lot out there already, such as http://www.4d-technologies.com/techcenter/ and http://www.menziengineering.ch/Downloads/Download.htm --- but of course no guarantee those are up to date or will be maintained. So anyway, some ideas could be gathered from those maybe...

    Thanks!
    R.K. McSwain | CAD Panacea |

  3. #3
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,109
    Login to Give a bone
    0

    Default Re: Simplify our life...

    Errortrapping, predicate functions, multiple options for passing an object (ename, elist, handle, objectid, etc...) Open source so you can maintain it yourself. Thats the idea at least. It makes the code easy to read and easier to maintain. It makes the code read more like vb. it also allows error management like a try catch.

    P=

  4. #4
    I could stop if I wanted to CEHill's Avatar
    Join Date
    2006-05
    Location
    TN
    Posts
    327
    Login to Give a bone
    0

    Default Re: Simplify our life...

    Learning LISP is a form of "joggin' for your noggin"! Independent maintainability is one of the main reasons that I am (still very slowly for now) learning this skill set. I look forward to the day I can depend much less on my current aftermarket product and other freely-available routines and create more complex LISP-based custom solutions from scratch.
    Yours,

    Clint
    Hill

    ------------------
    CAD Systems Operation and Management
    Chemical Plant Process + Mechanical Design Focus Areas

  5. #5
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,109
    Login to Give a bone
    0

    Default Re: Simplify our life...

    Dependence on any third party routines is an achillies heal of software development today. Most libraries are operating system/autocad version specific. You have it right... Develop your own libraries in lisp and they are neither operating sustem / autocad version specific. Love it and leave it. Maintenance is expensive. What functionality would you like to see to add to your open sourse library?

  6. #6
    I could stop if I wanted to CEHill's Avatar
    Join Date
    2006-05
    Location
    TN
    Posts
    327
    Login to Give a bone
    0

    Default Re: Simplify our life...

    With great trepidation I make reply.
    I have no formally list (until today) of desired LISP functionality. Therefore, I fear that I will address a topic off the top of my head that has already been provided a solution from you or other sharing souls on our beloved WAUN LISP Group.
    To be fair to you, I will submit a wish here only AFTER I take time to review my wishes against my WAUN e-mail archive (of at least the past five years).

    I don't supporting third party providers of CAD automation. I do desire to empower myself to create and modify customized solutions for specific tasks through LISP and, when mastered to a greater extent, create .NET-based solutions as well.
    Yours,

    Clint
    Hill

    ------------------
    CAD Systems Operation and Management
    Chemical Plant Process + Mechanical Design Focus Areas

  7. #7
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,109
    Login to Give a bone
    0

    Default Re: Simplify our life...

    I have been working on a simplification of Visual LISP having a function substitute the vla-* Methods to go along with the simplified properties mentioned above.

    So this is the simplified syntax.

    Code:
    (copy (entlast))
    Instead of

    Code:
    (errortrap '(vla-copy (vlax-ename->vla-object (entlast)))
    Because methods require different numbers of arguments... a csv file that includes the name of the method and the number of arguments is necessary to help create the new function calls.

    For other verticals you can run a function to add new objects to the csv file.

    There is a csv file for objects with objectnames like graphic objects and another for application level objects like documents etc...

    As far as I know... LISP doesn't have a way to know the number of arguments in a method (although if you know a way please share)

    Except for the (vlax-dump-object obj T) and then do a log file read and find the methods and get the text that is printed to the screen.

    This approach is also problematic because some arguments are optional.

    The functions have built in errortrapping and return nil for an error and T or a value for success.

    There is a way to add your developers prefix to the function calls too. so (copy obj) might become (code:copy obj) for example.

    Thoughts?

    P=
    Last edited by peter; 2015-04-28 at 03:54 PM.
    AutomateCAD

  8. #8
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,109
    Login to Give a bone
    0

    Default Re: Simplify our life...

    For those who are familiar with .net languages (I prefer vb.net for those functions)

    You may know about the Try/Catch/Finally syntax or on error resume next

    Code:
    Try
    ...
    Catch
    ...
    Finally
    ...
    End Try
    with the simplifies syntax I mention above you can

    Code:
    (if (and ; Try
         (setq obj (copy (entlast)))
         (move obj (list 0.0 0.0 0.0)(list 1.0 1.0 0.0))
         (colorput obj 1); Property Put
        )
     (princ "\nSuccess!"); Finally
     (princ "\nFailure!"); Catch
    )
    This has complete built in error trapping.
    AutomateCAD

  9. #9
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,109
    Login to Give a bone
    0

    Default Re: Simplify our life...

    I am getting close to posting my simplified lisp (open source) code.

    How would you like to be able to use this syntax?

    (item (layouts (activedocument (application))) 0)
    AutomateCAD

  10. #10
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,109
    Login to Give a bone
    0

    Default Re: Simplify our life...

    How would

    (item "layouts" "Layout1")

    be for simple.

    P=
    AutomateCAD

Page 1 of 2 12 LastLast

Similar Threads

  1. Simplify vertices on a polyline
    By mickaeL_renauD in forum AutoCAD General
    Replies: 9
    Last Post: 2009-03-23, 02:54 PM
  2. Simplify schedule
    By wfrst2008 in forum Revit Structure - General
    Replies: 4
    Last Post: 2007-09-07, 08:03 AM
  3. Trying to simplify windows
    By barathd in forum Revit Architecture - Families
    Replies: 2
    Last Post: 2006-01-17, 04:11 PM
  4. Simplify Surface
    By philipnoland in forum Revit Architecture - General
    Replies: 7
    Last Post: 2005-08-09, 09:01 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •