Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/01/2024 in all areas

  1. The only issue with stairs is the rise / run check, to do what you want need the Z difference as well, here in AUS there is standards to be met, just drawing the line work use array and done. So given your dwg would need the total Z and distance the 0.3 may need to be changed to meet code.
    1 point
  2. To run after select. (princ MyText) replace with (vl-cmdf mytext) Why would you have your run lisp programs as text ? Just make a menu if you can use notepad you can make a menu.
    1 point
  3. You enter the angle value - 30 degrees to the 0-X axis, and move the cursor to the floor at an angle of 120 degrees. Paradox!
    1 point
  4. Time to start learning a little..... (this is a good resource, http://www.lee-mac.com/tutorials.html ) The snippets of code will do what you want but a learning point for you to make that into a LISP perhaps? Use the link above and other examples we've given you to see if you can make something up. Pretty much for that create the first row '(defun .....' and the last row ')', saved in a file. For the next part you will need to select the text rather than pointing the mouse at the text (right clicks), for now though have a go at making the above into a LISP, post what you make up below and I am happy to guide you to the next steps of what you want to do. However it sounds like what you want is a menu rather than selecting texts in the drawing? An Alternative is a bit more work and a pop-up dialog with the commands listed that you can select
    1 point
  5. Look at entsel and entget. Something like this, untested, no CAD today to check for typos (setq MyEnt (entget (car (entsel "Select text:"))) ; Select an object ;; can do some checking here that the selected object is text (setq MyText (cdr (assoc 1 (MyEnt)))) ; get the text string from the object (princ MyText) I assume you want to do more than just display the text in the command line, but these 3 lines above will do that, add to a LISP routine or make your own based around this maybe Note that very long text strings (for example in mtext)(over 256 characters?) the text is stored in another variable in the entity description, something to be aware of
    1 point
  6. 1 point
  7. (defun c:11 (/ p0 ang dist) (defun 11error (errormsg /) (setvar "SNAPANG" old_snapang) ; reset variables (setvar "ORTHOMODE" old_orthomode) (setq *error* temperr) ; reset *error* (prompt "\nFunction Canelled.") ) (vl-load-com) (setq p0 (getpoint "Pick the first point >") ang (angtof (rtos (abs (getreal "Enter angle >"))) 0) ) (setq Old_snapang (getvar "SNAPANG")) ; to record what it was, might not be 0 (setq old_orthomode (getvar "ORTHOMODE")) (setq temperr *error*) ;store *error* ; can wait till here to set error function, after recording old variables (setq *error* 11error) (setvar "SNAPANG" ang) (setvar "ORTHOMODE" 1) (setq dist (distance p0 (getpoint p0 "Pick a second point >"))) (setvar "SNAPANG" Old_Snapang) ; moved this here, seto to old value (no assumption what it was) (setvar "ORTHOMODE" old_orthomode) (entmakex (list (cons 0 "LINE") (cons 10 p0) (cons 11 (polar p0 ang dist)))) (setq *error* temperr) ; reset error (princ) )
    1 point
  8. Prohibition of entering a negative value (defun c:11 (/ p0 ang dist) (defun 11error (errormsg /) (setvar "SNAPANG" old_snapang) ; reset variables (setvar "ORTHOMODE" old_orthomode) (setq *error* temperr) ; reset *error* (prompt "\nFunction Canelled.") ) (vl-load-com) (setq p0 (getpeint "Pick the first point >")) (initget 4) ; Entering negative numbers is not allowed (setq ang (angtof (rtos (getreal "Enter angle >")) 0)) (setq Old_snapang (getvar "SNAPANG")) ; to record what it was, might not be 0 (setq old_orthomode (getvar "ORTHOMODE")) (setq temperr *error*) ;store *error* ; can wait till here to set error function, after recording old variables (setq *error* 11error) (setvar "SNAPANG" ang) (setvar "ORTHOMODE" 1) (setq dist (distance p0 (getpoint p0 "Pick a second point >"))) (setvar "SNAPANG" Old_Snapang) ; moved this here, seto to old value (no assumption what it was) (setvar "ORTHOMODE" old_orthomode) (entmakex (list (cons 0 "LINE") (cons 10 p0) (cons 11 (polar p0 ang dist)))) (setq *error* temperr) ; reset error (princ) )
    1 point
  9. Here is some entmake samples. But starting out it may still be easier to use Command. I am sorry don't know where I got it from. Others may add more common functions. You need to have a basic understanding about the use of dxf codes. entmake functions.lsp
    1 point
  10. Ok just make sure it works correctly.
    1 point
  11. This can help you? (defun c:remove-vertex ( / ss n objent area_ori vertexlist v_list epoint cnt newlist index indexlist) (setq ss (ssget '((0 . "LWPOLYLINE")))) (cond (ss (repeat (setq n (sslength ss)) (and (setq objent (vlax-ename->vla-object (ssname ss (setq n (1- n)))) area_ori (vla-get-area objent) vertexlist (vlax-get objent "Coordinates") v_list vertexlist ) (not (zerop area_ori)) (repeat (/ (length v_list) 2) (setq epoint (list (car v_list) (cadr v_list)) cnt 0 newlist '() index (* 2 (fix (+ 0.5 (vlax-curve-getparamatpoint objent epoint)))) indexlist (list index (1+ index)) ) (foreach ordinate vertexlist (if (not (vl-position cnt indexlist)) (setq newlist (cons ordinate newlist)) ) (setq cnt (1+ cnt)) ) (not (vl-catch-all-apply 'vlax-put (list objent "Coordinates" (reverse newlist)) ) ) (if (equal (vla-get-area objent) area_ori 1E-08) (setq vertexlist (vlax-get objent "Coordinates")) (not (vl-catch-all-apply 'vlax-put (list objent "Coordinates" vertexlist) ) ) ) (setq v_list (cddr v_list)) ) ) ) ) ) )
    1 point
  12. 1 point
×
×
  • Create New...