+ Reply to Thread
Page 2 of 3 FirstFirst 1 2 3 LastLast
Results 11 to 20 of 22
  1. #11
    Luminous Being BlackBox's Avatar
    Computer Details
    BlackBox's Computer Details
    Operating System:
    Windows 8.1 Professional, Server 2012 R2 Datacenter
    Computer:
    Dell Precision T3600
    CPU:
    Hex-Core Intel Xeon 3.2Ghz
    RAM:
    32GB
    Graphics:
    3GB NVIDIA Quadro K4000
    Primary Storage:
    2 x 240GB Samsung EVO SSD (RAID 0)
    Secondary Storage:
    1TB Western Digital VelociRaptor 10K RPM
    Monitor:
    Dual 24" Dell Ultrasharp Widescreen Monitors
    Discipline
    Civil
    BlackBox's Discipline Details
    Occupation
    Senior Civil Designer
    Discipline
    Civil
    Details
    Public/Private Land Development, Transportation, and Utilities.
    Using
    Civil 3D 2016
    Join Date
    Nov 2009
    Posts
    5,282

    Default

    Registered forum members do not see this ad.

    Quote Originally Posted by RenderMan View Post
    Quote Originally Posted by Lee Mac View Post
    The above highlighted section should instead read 'function parameters', as global variables are not declared in the defun expression.
    Good catch, Lee; code corrected (oops).
    ... Actually no, that shouldn't be there either (in this instance).

    Your correction and reference to the Defun function are correct, it's just that as this is a c: prefixed symbol, the function parameters are not used.
    "Potential has a shelf life." - Margaret Atwood
    AutoCAD, and Civil 3D Certified Professional | Autodesk Authorized Developer
    Sincpac C3D ~ Exchange Apps ~ Autoloader ~ AutoCAD Security

  2. #12
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,902

    Default

    Another suggestion rather than use Dtr 180 why not pid, dtr 270 pil, your already using the defun Dtr so why not add a couple more, you can take the lisp value of PI and divide it etc

    Code:
    (setq Pil (* pi() 1.5))
    (setq pid pi() )
    (setq piu (* 0.5 pi() ))
    remember pir is 0.0 in radians to right you may want this for consistancy
    A man who never made mistakes never made anything

  3. #13
    Senior Member tomhamlet's Avatar
    Computer Details
    tomhamlet's Computer Details
    Operating System:
    Windows 7
    Computer:
    DELL Desktop
    CPU:
    AMD phenom 2 (6 core)
    RAM:
    6gig
    Graphics:
    1 gig
    Primary Storage:
    1 tb
    Monitor:
    Dell widescreen
    Discipline
    See details...
    tomhamlet's Discipline Details
    Occupation
    mechanical engineer, draftsman
    Discipline
    See details below.
    Details
    At Denios, we design storage and containment units for hazerdous materials. We also design cranes, racks, or whatever the customer needs.
    Using
    Mechanical 2011
    Join Date
    Oct 2012
    Location
    Louisville, KY
    Posts
    122

    Default

    [QUOTE=BIGAL;506163]Another suggestion rather than use Dtr 180 why not pid, dtr 270 pil, your already using the defun Dtr so why not add a couple more, you can take the lisp value of PI and divide it etc

    I have gotten so far as to know what pid, pil, piu, and pir is yet! thanks for the help guys. An extra thanks to Lee Mac, as his sight and tutorials were a big part, along with afralisp, of helping me understand the functions that went into this first lisp.
    Hard work beats talent every time talent doesn't work hard.

  4. #14
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    19,368

    Default

    Quote Originally Posted by tomhamlet View Post
    An extra thanks to Lee Mac, as his sight and tutorials were a big part, along with afralisp, of helping me understand the functions that went into this first lisp.
    You're very welcome - I'm delighted that my tutorials were helpful in your learning.

    Here are my suggestions for your program:
    Code:
    (defun c:ibeamp ( / 3pi/2 cm ih ip os p10 p11 p12 p13 p2 p3 p4 p5 p6 p7 p8 p9 pi/2 po pt pw )
        ;; Define function and declare local variables
        ;; Localising Variables: http://lee-mac.com/localising.html
    
        ;; If the following expression returns a non-nil value
        (if
            ;; All of the following expressions must return a non-nil
            ;; value for AND to return T
            (and
                ;; Prompt user for I-Beam parameters
                (setq ip (getpoint "\nInsertion Point: "))
                (setq pw (getdist ip "\nSpecify Beam Width: "))
                (setq ih (getdist ip "\nSpecify Inner Height: "))
                (setq pt (getdist ip "\nSpecify Plate Thickness: "))
                (setq po (getdist ip "\nSpecify Overhang Distance: "))
            ) ;; end AND
    
            (progn
                ;; Wrap the following expressions within a PROGN expression.
                ;; PROGN will simply evaluate every enclosed expression in turn
                ;; and will return the result of the last evaluated expression.
                ;;
                ;; By enclosing the expressions within the PROGN function, we
                ;; can pass the *single* PROGN expression to the IF function
                ;; to constitute the 'then' argument of the IF function.
    
                ;; Store some convenient multiples of pi:
                (setq  pi/2 (* pi 0.5)
                      3pi/2 (* pi 1.5)
                
                ;; Calculate the necessary points:
                         p2 (polar ip pi (/ pw 2.0))
                         p3 (polar p2 3pi/2 pt)
                         p4 (polar p3 0.0 po)
                         p5 (polar p4 3pi/2 ih)
                         p6 (polar p5 pi po)
                         p7 (polar p6 3pi/2 pt)
                         p8 (polar p7 0.0 pw)
                         p9 (polar p8 pi/2 pt)
                        p10 (polar p9 pi po)
                        p11 (polar p10 pi/2 ih)
                        p12 (polar p11 0.0 po)
                        p13 (polar p12 pi/2 pt)
                ) ;; end SETQ
    
                ;; Store Object Snap setting
                (setq os (getvar 'osmode)
                ;; Store CMDECHO setting
                      cm (getvar 'cmdecho)
                )            
                ;; Disable Object Snap
                (setvar 'osmode (logior os 16384))
                ;; Turn off CMDECHO
                (setvar 'cmdecho 0)
    
                ;; Construct a Polyline
                ;; "_"    = Accounts for other languages of AutoCAD
                ;; "."    = Use in-built command, not a redefinition
                (command "_.pline" ip p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 "_C")
    
                ;; Reset CMDECHO
                (setvar 'cmdecho cm)
                ;; Reset Object Snap setting
                (setvar 'osmode os)
                
            ) ;; end PROGN
    
            ;; If we had an 'else' expression for the IF function, it would go here.
            
        ) ;; end IF
        
        ;; Suppress the return of the last evaluated expression
        (princ)
    ) ;; end DEFUN
    I have tried not to deviate too far from your original code to keep the program clear and comprehensible for you to learn from, but please ask if you have any questions about any of my modifications or comments.
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

  5. #15
    Senior Member tomhamlet's Avatar
    Computer Details
    tomhamlet's Computer Details
    Operating System:
    Windows 7
    Computer:
    DELL Desktop
    CPU:
    AMD phenom 2 (6 core)
    RAM:
    6gig
    Graphics:
    1 gig
    Primary Storage:
    1 tb
    Monitor:
    Dell widescreen
    Discipline
    See details...
    tomhamlet's Discipline Details
    Occupation
    mechanical engineer, draftsman
    Discipline
    See details below.
    Details
    At Denios, we design storage and containment units for hazerdous materials. We also design cranes, racks, or whatever the customer needs.
    Using
    Mechanical 2011
    Join Date
    Oct 2012
    Location
    Louisville, KY
    Posts
    122

    Default

    Quote Originally Posted by Lee Mac View Post
    You're very welcome - I'm delighted that my tutorials were helpful in your learning.

    Here are my suggestions for your program:
    please, deviate as much as you can, the more you deviate, the more things i will see that I haven't before, so i will be forced to ask more questions and learn! Here are 2 that I have from your code:
    1. could you explain this line;(setvar 'osmode (logior os 16384)). I am not sure I am familiar with logior or the code 16384.
    2. what control is cmdecho?
    Hard work beats talent every time talent doesn't work hard.

  6. #16
    Luminous Being BlackBox's Avatar
    Computer Details
    BlackBox's Computer Details
    Operating System:
    Windows 8.1 Professional, Server 2012 R2 Datacenter
    Computer:
    Dell Precision T3600
    CPU:
    Hex-Core Intel Xeon 3.2Ghz
    RAM:
    32GB
    Graphics:
    3GB NVIDIA Quadro K4000
    Primary Storage:
    2 x 240GB Samsung EVO SSD (RAID 0)
    Secondary Storage:
    1TB Western Digital VelociRaptor 10K RPM
    Monitor:
    Dual 24" Dell Ultrasharp Widescreen Monitors
    Discipline
    Civil
    BlackBox's Discipline Details
    Occupation
    Senior Civil Designer
    Discipline
    Civil
    Details
    Public/Private Land Development, Transportation, and Utilities.
    Using
    Civil 3D 2016
    Join Date
    Nov 2009
    Posts
    5,282

    Default

    Quote Originally Posted by tomhamlet View Post
    please, deviate as much as you can, the more you deviate, the more things i will see that I haven't before, so i will be forced to ask more questions and learn! Here are 2 that I have from your code:
    1. could you explain this line;(setvar 'osmode (logior os 16384)). I am not sure I am familiar with logior or the code 16384.
    2. what control is cmdecho?
    I will not answer for Lee, but in anticipation of his response I would simply offer the suggestion that when curious about a function, feel free to look it up in the Developer Documentation.
    "Potential has a shelf life." - Margaret Atwood
    AutoCAD, and Civil 3D Certified Professional | Autodesk Authorized Developer
    Sincpac C3D ~ Exchange Apps ~ Autoloader ~ AutoCAD Security

  7. #17
    Senior Member tomhamlet's Avatar
    Computer Details
    tomhamlet's Computer Details
    Operating System:
    Windows 7
    Computer:
    DELL Desktop
    CPU:
    AMD phenom 2 (6 core)
    RAM:
    6gig
    Graphics:
    1 gig
    Primary Storage:
    1 tb
    Monitor:
    Dell widescreen
    Discipline
    See details...
    tomhamlet's Discipline Details
    Occupation
    mechanical engineer, draftsman
    Discipline
    See details below.
    Details
    At Denios, we design storage and containment units for hazerdous materials. We also design cranes, racks, or whatever the customer needs.
    Using
    Mechanical 2011
    Join Date
    Oct 2012
    Location
    Louisville, KY
    Posts
    122

    Default

    once again dooped by my own tendancy to go straight to the web, rather than use the autocad help right under my nose. thanks RenderMan, i will definately look into it.
    Hard work beats talent every time talent doesn't work hard.

  8. #18
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    19,368

    Default

    Quote Originally Posted by tomhamlet View Post
    please, deviate as much as you can, the more you deviate, the more things i will see that I haven't before, so i will be forced to ask more questions and learn!
    True - but equally you don't want to be overwhelmed with information when you are just starting out; by keeping close to your original code, you can follow and understand my alterations without feeling that I have simply written the program for you

    Quote Originally Posted by tomhamlet View Post
    1. could you explain this line;(setvar 'osmode (logior os 16384)). I am not sure I am familiar with logior or the code 16384.
    The 16384 bit-code disables Object Snap whilst retaining the various Object Snap settings (such as endpoint / midpoint / intersection etc.) - setting the 16384 bit-code in the OSMODE System Variable is the equivalent of the user toggling the Object Snap off using the F3 key.

    The full list of bit-codes for the OSMODE System Variable is as follows (this list can be found by listing the OSMODE System Variable in the sysvdlg command):

    Code:
    0       NONe
    1       ENDpoint
    2       MIDpoint
    4       CENter
    8       NODe
    16      QUAdrant
    32      INTersection
    64      INSertion
    128     PERpendicular
    256     TANgent
    512     NEArest
    1024    QUIck
    2048    APParent Intersection
    4096    EXTension
    8192    PARallel
    16384   Disable Object Snap
    As for logior, now we are entering the realm of bitwise logic - logior returns the bitwise inclusive OR (as opposed to the exclusive XOR) of two or more integers. If you need more information about bitwise logic, there are a plethora of examples on the web, as bitwise values are used extensively in many programming languages.

    Quote Originally Posted by tomhamlet View Post
    2. what control is cmdecho?
    CMDECHO

    Or look it up using sysvdlg
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

  9. #19
    Senior Member tomhamlet's Avatar
    Computer Details
    tomhamlet's Computer Details
    Operating System:
    Windows 7
    Computer:
    DELL Desktop
    CPU:
    AMD phenom 2 (6 core)
    RAM:
    6gig
    Graphics:
    1 gig
    Primary Storage:
    1 tb
    Monitor:
    Dell widescreen
    Discipline
    See details...
    tomhamlet's Discipline Details
    Occupation
    mechanical engineer, draftsman
    Discipline
    See details below.
    Details
    At Denios, we design storage and containment units for hazerdous materials. We also design cranes, racks, or whatever the customer needs.
    Using
    Mechanical 2011
    Join Date
    Oct 2012
    Location
    Louisville, KY
    Posts
    122

    Default

    Thanks again Lee. If you get a chance, I could really use your help on a new thread i posted http://www.cadtutor.net/forum/showth...-Lisp-for-Tags.
    Hard work beats talent every time talent doesn't work hard.

  10. #20
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    19,368

    Default

    Registered forum members do not see this ad.

    Quote Originally Posted by tomhamlet View Post
    Thanks again Lee. If you get a chance, I could really use your help on a new thread i posted http://www.cadtutor.net/forum/showth...-Lisp-for-Tags.
    You're welcome; but please understand that my time here is voluntary and without remuneration, I'm sure other members can offer some you some assistance.
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

Similar Threads

  1. Replies: 3
    Last Post: 10th Aug 2010, 04:39 am
  2. Profile gets over-written
    By antheads in forum AutoCAD General
    Replies: 0
    Last Post: 15th Feb 2010, 09:49 am
  3. remember what was written
    By Ferronovum in forum Feedback
    Replies: 11
    Last Post: 10th Feb 2009, 02:36 pm
  4. Have Written first independent LISP but AutoCAD says Unknown Command.
    By skipsophrenic in forum AutoLISP, Visual LISP & DCL
    Replies: 11
    Last Post: 8th Jan 2009, 06:33 pm
  5. inputting hand written survey points to CAD
    By scubadoo in forum AutoCAD General
    Replies: 31
    Last Post: 22nd Nov 2007, 11:36 pm

Tags for this Thread

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