+ Reply to Thread
Page 2 of 2 FirstFirst 1 2
Results 11 to 20 of 20

Thread: My first Lisp

  1. #11
    Forum Deity steven-g's Avatar
    Computer Details
    steven-g's Computer Details
    Operating System:
    Win 7
    Discipline
    Construction
    steven-g's Discipline Details
    Occupation
    Draughtsman
    Discipline
    Construction
    Details
    I work in the estimating department of a large building contractor.
    Using
    AutoCAD 2018
    Join Date
    May 2013
    Location
    An Englishman in Belgium
    Posts
    2,145

    Default

    Registered forum members do not see this ad.

    Coding and programming are very big words when applied to me, my very first computer was a 'Sinclair ZX81' which gives a pretty good clue as to which year that was, and I started straight away with Basic and the many variations that followed it, I also did a fair bit of machine language programming which ended when windows came into popular usage, And I progressed onto VBA because it felt natural. But I have a definite go round and kick the tires approach and if anything drops off that doesn't look important then it can probably be ditched.

    Dadgad
    Thank you for the encouragement I have regularly been looking trying to decipher what all this Lisp is about but it's like the Lisp Forum is only used by people speaking another language up to now, it's only just starting to feel like the veil is lifting.

    BIGAL
    I'm ashamed to say you lost me on the first post, that's how little I know, just with the line (defun SG:visibility () I was under the impression that the C: was to let Autocad know the name of the Command and you just blew that away by using SG:visibility, but actually the rest of the post does make a lot of sense.

    Tharwat
    The acet-ss-visible wasn't so much a concious choice it was the only way I found of performing a reinstatement of visibility for a selection and didn't involve just making everything visible again as in unhide, the reason I am trying to set this up is that in a busy drawing I can keep selecting odd iems and hide them, perform some actions then hide something else to get at other entities and then further down the line I might need to just be able to see a couple of objects again to see how thigs are progressing but the normal unhide from the ribbon will only unhide everyhthing. And in Autocad there is no way to select just a few items at random once they are no longer visible, in Bricscad you can, but unhide is still all or nothing, so the actual selection sets have no real value beyond "hide this now" and "show that then" it is an unlikely scenario that the two will act on the same iems and I havent found a method to unhide just a selection no matter how you select it, without using visibility.

    Grrr
    That makes sense about the variables and your color coding in just those couple of examples actually has cleared up a lot in my mind, to tell the truth, I hadn't tried using the VLIDE console and it does make things quite a bit clearer so I'm going to study that some more. But Bricscad's BLADE looks very interesting as well. And I will take the time to study Lee's site I have tried before but to be honest, it always lost me, but now I have some actual real problems to try and work out it's no longer just theory and it is all actually beginning to make a bit of sense.

    rlx
    All my best stuff in VBA is stolen (or should I say borrowed) and if I was intimidated by people with more brain cells than me I'd never leave the house.

    PDuMont
    It feels more like into the snake pit, but I'm in there now so no climbing out.

    It's a breakthrough moment for me, just this silly first attempt probably already saved me half an hour just today, and when I can get this into a toolbar along with just a few other items it is going to make such a big difference.
    I've just been down graded from 2012LT to full Autocad 2017. I WANT LT BACK

  2. #12
    Super Member rlx's Avatar
    Computer Details
    rlx's Computer Details
    Operating System:
    W10
    Computer:
    i74ghz/ssd500/2tbhdd
    Discipline
    Electrical
    rlx's Discipline Details
    Occupation
    electrical designer dragon
    Discipline
    Electrical
    Details
    I dont excel in anything but I rearly give up
    Using
    AutoCAD 2016
    Join Date
    Nov 2014
    Location
    Bergen op Zoom , Netherlands
    Posts
    943

    Default

    Sometimes the tiniest of things make the biggest difference. Half or most of us are just copy-cats (not me of course , I'm a copy-dragon haha) and of course you have the ones who , how can I put it mildly , just want to suck your brain dry


    but I'm glad you want to

  3. #13
    Super Member
    Discipline
    Multi-disciplinary
    Using
    AutoCAD 2015
    Join Date
    Nov 2013
    Posts
    1,421

    Default

    Quote Originally Posted by rlx View Post
    Half or most of us are just copy-cats (not me of course , I'm a copy-dragon haha)


    Thats true, attempting to do so many stuff without enough knowledge/experience only by yourself will lead to alot of wasted time (which inefficient for the 21st Century).
    BTW I prefer the 'murican proverb: "Monkey see, monkey do".

  4. #14
    Super Member rlx's Avatar
    Computer Details
    rlx's Computer Details
    Operating System:
    W10
    Computer:
    i74ghz/ssd500/2tbhdd
    Discipline
    Electrical
    rlx's Discipline Details
    Occupation
    electrical designer dragon
    Discipline
    Electrical
    Details
    I dont excel in anything but I rearly give up
    Using
    AutoCAD 2016
    Join Date
    Nov 2014
    Location
    Bergen op Zoom , Netherlands
    Posts
    943

    Default

    I wouldn't know about the monkey business because when I see one , cause of my dragon instinct , I would have eaten it before he / she could have said anything haha But apart from that I'm completely normal ... for a dragon that is

    oh sorry

  5. #15
    Super Member
    Discipline
    Multi-disciplinary
    Using
    AutoCAD 2015
    Join Date
    Nov 2013
    Posts
    1,421

    Default

    The copy dragon Rlx eats the copy-cats and the copy monkies for breakfast!

  6. #16
    Quantum Mechanic
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    10,400

    Default

    Another suggestion is don't forget about a piece of paper and pencil , when doing complicated editing using points I often draw a sketch and keep track of my point numbers and which object their pointing at. Bit like the old fashioned flow chart.

    When dealing with angles its a good idea to work in radians, be well aware that Autocad expects zero as EAST and anticlockwise, this can catch you out, a simple way around is to use setvar's to match then return at end.

    Converting VBA to VLISP is not to hard they are very similar.

    Give some hints on what you want to automate. If you do it repeatedly then automate it.

    SG:visibility was about using a library lisp and loading as required again for us it would be a toolbar or menu option maybe. Look into "Autoload" this will demand load a lisp via a command in our case its part of our start up lisp. Thats another area to look at also is lisps loaded on startup can be really simple, add to acaddoc.lsp

    This will be your best friend if using VL there are others out there that go deeper.

    Code:
    (defun C:DumpIt ( / ent) 
      (while (setq ent (entsel)) 
        (vlax-Dump-Object 
          (vlax-Ename->Vla-Object (car ent)) T
        ) 
      ) 
      (princ) 
    )
    Last edited by BIGAL; 14th Apr 2018 at 12:58 am.
    A man who never made mistakes never made anything

  7. #17
    Super Member hanhphuc's Avatar
    Using
    AutoCAD 2007
    Join Date
    Apr 2013
    Location
    Happy Garden
    Posts
    622

    Default

    This thread reminds my 1st VLIDE experience the only thing i recognize was the
    CAR
    have you noticed at the search box ?
    what the heck was that CAR for?

    ie: Familiarizing the functions is fundamental & important


    p/s : CAR - Content of Address Register
    _$ ( apply 'equal "hp" "happy" "hạnh phúc" "ハッピー" "幸福" "행복" )
    ; error: too many arguments

  8. #18
    Forum Deity steven-g's Avatar
    Computer Details
    steven-g's Computer Details
    Operating System:
    Win 7
    Discipline
    Construction
    steven-g's Discipline Details
    Occupation
    Draughtsman
    Discipline
    Construction
    Details
    I work in the estimating department of a large building contractor.
    Using
    AutoCAD 2018
    Join Date
    May 2013
    Location
    An Englishman in Belgium
    Posts
    2,145

    Default

    Quote Originally Posted by BIGAL View Post
    This will be your best friend if using VL there are others out there that go deeper.

    Code:
    (defun C:DumpIt ( / ent) 
      (while (setq ent (entsel)) 
        (vlax-Dump-Object 
          (vlax-Ename->Vla-Object (car ent)) T
        ) 
      ) 
      (princ) 
    )
    Thanks BIGAL I also found PRINTDXF on the Autodesk webpages which lists an awful lot of information about entities, I can see this is going to be hard going, just reading all the properties never mind actually trying to pick them out for use in selections etc. One of the next tasks I have set myself is selecting the faces of solids that all face the same way (ie all have the same normal) I'm just trying to figure that one out now.


    @hanhphuc CAR? thats what gets me to work on a morning, which does bring up a valid point, for me at least it's confussing sometimes when odd naming conventions show up, it took me a long time to realise that just something simple like ss can sometimes be used in a keyword such as
    Code:
    (setq ss (ssget)
    and other times it actually represents a variable
    Code:
    (setq ss (ssget)
    and as such could just as easily be
    Code:
    (setq PinkElephant (ssget)
    but wouldn't then change to
    Code:
    (setq PinkElephant (PinkElephantget)
    and I kept on trying to find the second PinkElephant in all the code I was seeing, (if that makes sense) and indeed using an actual code editor does make it a lot easier to follow.


    Following on from my original code above, I did do some more digging and changed the code I am using to this which uses the "hideobjects/isolateobjects" commands which is a better method because everything is restored when you close a dwg unlike the "visible" attribute which may well leave my collegues scratching their heads when half a drawing is missing
    Code:
    ;Based on this thread and BeekeeCZ's input https://forums.autodesk.com/t5/autocad-mep-forum/hidden-objects-list/td-p/6602446
    (defun C:uhi (/ ss ss1)
      (setq ss (ssget))
      (command "_.plan" "")
      (setq ss1 (ssget "_C" (getvar 'EXTMIN) (getvar 'EXTMAX)))
      (command "_.ZOOM" "_P")
      (command "unhide")
      (command "isolate" ss ss1 "")
    )
    Last edited by steven-g; 17th Apr 2018 at 11:31 am. Reason: Fixed code
    I've just been down graded from 2012LT to full Autocad 2017. I WANT LT BACK

  9. #19
    Quantum Mechanic
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    10,400

    Default

    C:uhi is missing a closing bracket, you only posted as a sample ?

    Just me type (defun xxx then a couple of blank lines then ) this way defuns, Ifs, etc are always closed when you get (if (and (or can get lost in bracket translation.

    You seem to be doing the same thing twice if you pick all in the selection ss its the same as using extents in ss1 ? Even if you pick a few the extents selection just doubles up the selection. Trying to isolate the same layer twice.
    Code:
    (setq ss (ssget))
    
    <Selection set: 30>
    Command: (sslength ss)
    52
    
    Command: PLAN
    Command: (setq ss1 (ssget "_C" (getvar 'EXTMIN) (getvar 'EXTMAX)))
    <Selection set: 33>
    
    Command: (sslength ss1)
    52
    Last edited by BIGAL; 17th Apr 2018 at 11:34 am.
    A man who never made mistakes never made anything

  10. #20
    Forum Deity steven-g's Avatar
    Computer Details
    steven-g's Computer Details
    Operating System:
    Win 7
    Discipline
    Construction
    steven-g's Discipline Details
    Occupation
    Draughtsman
    Discipline
    Construction
    Details
    I work in the estimating department of a large building contractor.
    Using
    AutoCAD 2018
    Join Date
    May 2013
    Location
    An Englishman in Belgium
    Posts
    2,145

    Default

    Registered forum members do not see this ad.

    Oops fixed now, it got lost in copy paste.
    I've just been down graded from 2012LT to full Autocad 2017. I WANT LT BACK

Similar Threads

  1. Replies: 1
    Last Post: 28th Jul 2017, 09:27 am
  2. Replies: 14
    Last Post: 24th Mar 2017, 08:23 am
  3. Pause a lisp to interact with a dynamic block and then resume the lisp
    By woodman78 in forum AutoLISP, Visual LISP & DCL
    Replies: 4
    Last Post: 29th May 2015, 10:38 am
  4. [LISP] First time writing LISP routine... trying to rotate, move and scale
    By chiimayred in forum AutoLISP, Visual LISP & DCL
    Replies: 6
    Last Post: 18th Jul 2013, 06:02 pm
  5. Replies: 3
    Last Post: 10th Aug 2010, 04:39 am

Bookmarks

Posting Permissions

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