Jump to content

Leaderboard

Popular Content

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

  1. @Ashishs Give this version a try: ;; Written by PJK 11/26/2024 ;; Topic: https://www.cadtutor.net/forum/topic/94150-looking-for-a-lsp-to-select-a-dimension-in-the-drawing-and-change-the-color-to-red-for-any-type-of-dimension-be-it-a-rotated-aligned-or-angular/ (defun c:dimred (/ e e2 i l l2 ss) (if (setq ss (ssget '((0 . "DIMENSION,*LEADER")))) (repeat (setq i (sslength ss)) (setq e (ssname ss (setq i (1- i))) l (entget e) ) (if (wcmatch (cdr (assoc 0 l)) "DIMENSION,LEADER,QLEADER") (progn (command "._dimoverride" "_dimclre" 1 "_dimclrd" 1 "_dimclrt" 1 "" e "") (if (assoc 340 l) (progn (setq l2 (entget (setq e2 (cdr (assoc 340 l))))) (if (assoc 62 l2) (progn (entmod (subst (cons 62 1) (assoc 62 l2) l2))(entupd e2)) (progn (entmod (append l2 (list (cons 62 1))))(entupd e2)) ) ) ) ) (if (assoc 62 l) (progn (entmod (subst (cons 62 1) (assoc 62 l) l))(entupd e)) (progn (entmod (append l (list (cons 62 1))))(entupd e)) ) ) ) ) (princ) )
    2 points
  2. You can't expect from this Forum to write you a Lisp program every time you realize that you could do something faster or just more convenient. Start learning, try changing the existing programs to better suit your needs and post again when you need help.
    2 points
  3. You can not use that code this will always Fail its not supported in LT2024 25, you can not do a vlax-get-or-create-object (vlax-get-or-create-object "Excel.Application") Ok what will work is to write a csv file. Then read that file into Excel. Not sure if "Shell" function is supported, then can as last line start excel and open the csv. Try this change path and filename to one you have. If you dont have a csv just save one from Excel for test. (startapp "Excel.exe" "D:\\acadtemp\\tags.csv") Let us know if it works.
    1 point
  4. @Mohamed_Essam_2000 Here's a quick one to draw the line and add circles at the end: (defun c:foo (/ _circle d p1 p2 r) ;; RJP » 2024-11-26 (defun _circle (p r) (entmakex (list '(0 . "CIRCLE") (cons 10 p) (cons 40 r)))) (cond ((and (setq p1 (getpoint "\nSpecify first point: ")) (setq p2 (getpoint p1 "\nSpecify next point: ")) ) (_circle p1 (setq r 0.75)) (_circle p2 r) (entmakex (list '(0 . "LINE") (cons 10 (polar p1 (angle p1 p2) (setq d (- (distance p1 p2) r)))) (cons 11 (polar p2 (angle p2 p1) d)) ) ) ) ) (princ) ) And one to select lines: (defun c:foo (/ _circle d el p1 p2 r s) ;; RJP » 2024-11-26 (defun _circle (p r) (entmakex (list '(0 . "CIRCLE") (cons 10 p) (cons 40 r)))) (cond ((setq s (ssget ":L" '((0 . "LINE")))) (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))) (_circle (setq p1 (cdr (assoc 10 (setq el (entget e))))) (setq r 0.75)) (_circle (setq p2 (cdr (assoc 11 (entget e)))) r) (setq el (entmod (subst (cons 10 (polar p1 (angle p1 p2) r)) (assoc 10 el) el))) (entmod (subst (cons 11 (polar p2 (angle p2 p1) r)) (assoc 11 el) el)) ) ) ) (princ) )
    1 point
  5. From what I can see, the arc center and end points are switched. Try to change the COMMAND function: (COMMAND "arc" "c" (list cx cy 0.0) (list x1 y1 0.0) (list x2 y2 0.0)) Or a better approach: try to use ENTMAKE to draw the arc. These days I posted in the Forum a program drawing Arcs using that way. Good luck!
    1 point
  6. @DeEng I suggest the following code instead. The value of (done_dialog) is returned from (start_dialog) when a call to (done_dialog) is made with an integer argument. (defun c:MAIN () (setvar "OSMODE" 0) (create-layers) (setq dcl_id (load_dialog "kart.dcl")) (if (not dcl_id) (alert "DCL file could not be loaded!") ) (if (new_dialog "main_dialog" dcl_id) (progn (action_tile "btn_info" "(done_dialog 1)");<---set return value in (done_dialog) to be captured by the result of (start_dialog) (action_tile "btn_holes" "(done_dialog 2)") (action_tile "btn_open_model" "(done_dialog 3)") (action_tile "btn_open_card" "(done_dialog 4)") (action_tile "btn_working_directory" "(done_dialog 5)") (action_tile "btn_exit" "(done_dialog 0)") (setq useraction (start_dialog));<---- Capture result of (done_dialog) ) ) (unload_dialog dcl_id) (cond ((= userAction 1) (show_info_dialog)) ((= userAction 2) (show_holes_dialog)) ((= userAction 3) (open_model_file)) ((= userAction 4) (open_card_file)) ((= userAction 5) (select_working_directory)) ((= userAction 0) (princ "\nDone."));<---- Exit is not necessary here. (T (alert "No valid action selected.")) ) ) The AutoCAD Help is not very clear on this, but you can use ANY integer value in (done_dialog) and it will be returned to (start_dialog). https://help.autodesk.com/view/ACDLT/2024/ENU/?guid=GUID-A150544E-ACE5-415F-AAB4-930E2715FDC7 ALSO: as i noted previously, (exit) is not necessary. It evokes the error handler, which is not desired to exit a function cleanly.
    1 point
  7. A centerline profile of a road, or a driveway, would be one that runs right down the center of the road showing the elevation of the roadway itself. Typically this is generated from the plan view where one would note any contours the centerline crosses and/or any spot elevations that happen to fall on the centerline. When I worked for a municipal engineering department and we drew centerline profiles station 0+00 (the start of the stationing) would be the intersection of the street we were doing the drawing for and the cross street we were working from. I think in this project station 0+00 starts out at the center of the cul-de-sac doesn't it? Stationing is a way of indicating distance. We typically set our stationing in one hundred foot increments. Thus the first station that was 100 feet away got the designation of 1+00. The next one hundred footer got designated as station 2+00 the next was station 3+00 and so on. See the pattern that is developing here? If we were 50 feet down the road from the start of our stationing it would be called station 0+50. If we were 275 feet from the beginning the station would be 2+75. Once again see how this is progressing? Sections represent a cut through the earth viewed in the direction the cut line arrows indicate. In this project the sections will show how the land rises and falls.
    1 point
×
×
  • Create New...