Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/23/2023 in all areas

  1. Like others if you know command then windows can help, you run command mode, change to the directory where your lsp files are and do Findstr rad2deg *.lsp and it will display all the files with that text. You can look in your menu files also use CUI or if your lucky can open the .mnu files, also look for mnl files they load lisps as well. If its a big lisp could look for C : using findstr and get all the command defuns. go bottom left in windows type CMD then for this lisp directory D: CD \LISP D:\LISP>findstr aaa *.lsp AdvancedPolyOutlineV1-2.lsp: (and (caaar lst) (caaadr lst) AdvancedPolyOutlineV1-2.lsp: (setq ep1 (f (_endpoints (caaar lst) (last (caar lst))))) AdvancedPolyOutlineV1-2.lsp: (setq ep2 (f (_endpoints (caaadr lst) (last (caadr lst))))) repeat object along line.lsp:; change aaa to soemthing else to suit repeat object along line.lsp:(defun c:aaa ( / pt1 pt2 pt3 ans oldang oldangdir oldsnap xoff yoff maxspc dia ) repeat object along line.lsp:(alert "Type aaa to run again") repeat object along line.lsp:(c:aaa) ss.lsp:(defun c:aaa ( / ss) D:\LISP> Similar to Notepad method
    1 point
  2. @3dwannab What I can offer you... I tried with your drawing and it seems to work. Initially my COUPE_TN routine only works with 3Dfaces from a natural terrain mesh. So I made 3Faces with your 3Dpoly (to see if it worked) with the 3dpolTO3dface routine I exploded your cut polyline to just get a line Then routine COUPE_TN is launched, I select your line representing the line of cut. The profile number is then requested, then the scale of the cut (the default value of 100 is very suitable for your example) The curvilinear abscissa of the profile is requested. And there; the TN section is drawn with the dimensions of distance and altitude. The axis is supposed to be the midpoint of the initially selected line. These routines are in French but should work anyway. Is this a good start for you? 3dpolTO3dface.lsp coupe_tn.lsp
    1 point
  3. Why not just use ADDSELECTED command and Cancel when it starts to draw... @Dahzeealready suggested it, but you neglected it...
    1 point
  4. SOLVED! It was LAYOUTREGENCTL sys variable, it was set to 2 (by default), changed it to 0 like it was on my previous work pc. Listed all variables from old pc and compared with current.
    1 point
  5. Thanks for the info @Steven P. I've found this routine that spits out points at apparent intersections. I can then try adding drawing a polyline using the z values of the points this routine gathers. https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/creating-points-at-3d-polyline-intersections/m-p/9692929#M403477
    1 point
  6. 1 point
  7. @Steven P Had an issues with BircsCAD using command to change font styles. User would crash randomly. had something to do with updating all existing fonts at once. but didn't happen when using entmake. or typing it manually only in lisp. another example of how quirky command is. Also don't forget to set your dimension font style. (setvar 'DIMTXSTY myfont)
    1 point
  8. This command allows you to clone a command from an entity already placed in the drawing. Use: Run the DYN_CLONE command Move the cursor over an entity in the drawing: The name of the entity appears in the status bar, instead of the coordinates. If this entity suits you, validate with a right-click and the appropriate command will be launched, taking up its properties (defun c:dyn_clone ( / sv_shmnu loop key ent dxf_ent nam_bl typ_ent lay_ent lin_ent col_ent wid_ent sct_ent flag tabl_dxf cmd_clone) (setq sv_shmnu (getvar "SHORTCUTMENU") loop 0 ) (setvar "SHORTCUTMENU" 11) (while (and (setq key (grread T 4 0)) (not (member key '((2 13) (2 32)))) (/= (car key) 25)) (cond ((and (eq (car key) 3) ent) (setq loop (rem (1+ loop) 2)) ) (T (setq ent (nentselp "" (cadr key))) ) ) (cond ((and ent (zerop loop)) (if (eq (type (car (last ent))) 'ENAME) (setq dxf_ent (entget (car (last ent))) nam_bl (cdr (assoc 2 dxf_ent)) ) (setq dxf_ent (entget (car ent)) nam_bl nil) ) (if (member (cdr (assoc 0 dxf_ent)) '("VERTEX" "ATTRIB")) (progn (setq dxf_ent (entget (cdr (assoc 330 dxf_ent)))) (if (assoc 2 dxf_ent) (setq nam_bl (cdr (assoc 2 dxf_ent)))) ) ) (setq typ_ent (cdr (assoc 0 dxf_ent)) lay_ent (cdr (assoc 8 dxf_ent)) lin_ent (cdr (assoc 6 dxf_ent)) col_ent (cdr (assoc 62 dxf_ent)) wid_ent (cdr (assoc 370 dxf_ent)) sct_ent (cdr (assoc 48 dxf_ent)) ) (grtext -2 typ_ent) ) ) ) (cond ((eq typ_ent "LWPOLYLINE") (setq typ_ent "PLINE") (if (assoc 43 dxf_ent) (setvar "PLINEWID" (cdr (assoc 43 dxf_ent))) (setvar "PLINEWID" (if (equal (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 40)) dxf_ent)) (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 41)) dxf_ent)) ) (* 0.5 (+ (cdr (assoc 40 dxf_ent)) (cdr (assoc 40 dxf_ent)))) 0.0 ) ) ) ) ((eq typ_ent "POLYLINE") (setq flag (rem (cdr (assoc 70 dxf_ent)) 128)) (cond ((< flag 6) (setq typ_ent "PLINE") (setvar "PLINEWID" (if (equal (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 40)) dxf_ent)) (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 41)) dxf_ent)) ) (* 0.5 (+ (cdr (assoc 40 dxf_ent)) (cdr (assoc 40 dxf_ent)))) 0.0 ) ) ) ((and (> flag 7) (< flag 14)) (setq typ_ent "3DPOLY") ) ((> flag 15) (setq typ_ent "3DMESH") ) ) ) ((or (eq typ_ent "HATCH") (eq typ_ent "SHAPE")) (setq nam_bl (cdr (assoc 2 dxf_ent))) ) ((eq typ_ent "DIMENSION") (setq nam_bl nil) (command "_.-dimstyle" "_restore" (cdr (assoc 3 dxf_ent))) (cond ((eq (boole 6 (rem (cdr (assoc 70 dxf_ent)) 128) 32) 0) (setq typ_ent "DIMLINEAR") ) ((eq (boole 6 (rem (cdr (assoc 70 dxf_ent)) 128) 32) 1) (setq typ_ent "DIMALIGNED") ) ((or (eq (boole 6 (rem (cdr (assoc 70 dxf_ent)) 128) 32) 2) (eq (boole 6 (rem (cdr (assoc 70 dxf_ent)) 128) 32) 5)) (setq typ_ent "DIMANGULAR") ) ((eq (boole 6 (rem (cdr (assoc 70 dxf_ent)) 128) 32) 3) (setq typ_ent "DIMDIAMETER") ) ((eq (boole 6 (rem (cdr (assoc 70 dxf_ent)) 128) 32) 4) (setq typ_ent "DIMRADIUS") ) ((or (eq (boole 6 (rem (cdr (assoc 70 dxf_ent)) 128) 32) 6) (eq (boole 6 (rem (cdr (assoc 70 dxf_ent)) 128) 32) 70)) (setq typ_ent "DIMORDINATE") ) (T (setq typ_ent "DIM")) ) ) ((eq typ_ent "VIEWPORT") (setq typ_ent "VPORTS") ) ((eq typ_ent "3DSOLID") (initget 1 "BOîte Sphère CYlindre CÔne BIseau Tore _Box Sphere CYlinder COne Wedge Torus") (setq typ_ent (getkword "\n[BOîte/Sphère/CYlindre/CÔne/BIseau/Tore]: ")) ) ((or (eq typ_ent "TEXT") (eq typ_ent "MTEXT") (eq typ_ent "ATTDEF")) (setvar "TEXTSTYLE" (cdr (assoc 7 dxf_ent))) (setvar "TEXTSIZE" (cdr (assoc 40 dxf_ent))) ) ) (grtext -2 "") (setvar "SHORTCUTMENU" sv_shmnu) (cond (typ_ent (setvar "clayer" lay_ent) (if lin_ent (setvar "celtype" lin_ent) (setvar "celtype" "ByLayer")) (if col_ent (setvar "cecolor" (itoa col_ent)) (setvar "cecolor" "256")) (if wid_ent (setvar "celweight" wid_ent) (setvar "celweight" -1)) (if sct_ent (setvar "celtscale" sct_ent) (setvar "celtscale" 1.0)) (setq cmd_clone (strcat "_." typ_ent)) (if nam_bl (progn (if (and (setq tabl_dxf (tblsearch "BLOCK" nam_bl)) (eq (boole 1 (cdr (assoc 70 tabl_dxf)) 4) 4)) (command "_.-XREF" "_attach" nam_bl) (command cmd_clone nam_bl) ) ) (command cmd_clone) ) ) (T (prin1)) ) )
    1 point
  9. Another way is draw an object with predefined settings layer, linetype, color etc. So would have some shortcuts like B1, B2 to draw beams with correct settings. We also had a group of lines with predefined set up, and would just paste to the edge of our project so using say Tharwat code they are all available. Ps saved in a layout not model so would use Ctrl+X to cut then go to model and paste Ctrl+V.
    1 point
  10. Would a defun for entmake pline '(p1 p2 p3 p1 p4 p2) then explode maybe take 2.9 seconds ?
    1 point
  11. Steven P yes can use Steal driven via lisp a few lines of code. Just demand load Steal 1st. (If (not steal)(load "StealV1-8")) ;; The following example will attempt to import Layers: 'Layer1' & 'Layer2', and all Dimension ;; ;; Styles beginning with 'DimStyle' (not case-sensitive) from the drawing: ;; ;; 'C:\My Folder\MyDrawing.dwg' into the current drawing. ;; ;; ;; ;; (Steal "C:\\My Folder\\MyDrawing.dwg" ;; ;; '( ;; ;; ( ;; ;; "Layers" ;; ;; ("Layer1" "Layer2") ;; ;; ) ;; ;; ( ;; ;; "Dimension Styles" ;; ;; ("DimStyle*") ;; ;; ) ;; ;; ) ;; ;; )
    1 point
  12. Give this a shot and let me know. (defun c:Test (/ *error* sel get lay clr lty scl var val ) ;;----------------------------------------------------;; ;; Author : Tharwat Al Choufi ;; ;; website: https://autolispprograms.wordpress.com ;; ;;----------------------------------------------------;; (defun *error* (msg) (and val (mapcar 'setvar var val)) (if (and msg (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*") (princ "\n*Cancel*")) (princ (strcat "\nError => " msg))) ) (if (and (setq sel (car (entsel "\nSelect object to get properties from : "))) (setq get (entget sel) lay (cdr (assoc 8 get)) ) (or (/= 4 (logand 4 (cdr (assoc 70 (entget (tblobjname "LAYER" lay)))))) (alert "Object resides on locked layer!. Try again") ) (setq clr (cond ((cdr (assoc 62 get))) (256))) (setq lty (cond ((cdr (assoc 06 get))) ("ByLayer"))) (setq scl (cond ((cdr (assoc 48 get))) (1.0))) (setq var '(CECOLOR CELTYPE CLAYER) val (mapcar 'getvar var) ) (mapcar 'setvar var (list (itoa clr) lty lay)) ) (progn (vl-cmdf "_.LINE") (while (= (getvar 'CMDACTIVE) 1) (entmod (append (entget (entlast)) (list (cons 48 scl)))) (vl-cmdf "\\")) ) ) (*error* nil) (princ) )
    1 point
  13. Here, help yourself... (defun c:polyboundrect ( / ss s1 s2 rect rectx b1 b2 x1 x2 pl p0 p1 p2 p3 ) (prompt "\nSelect LWPOLYLINE or LINE BOUNDARIES and RECTANGLE LWPOLYLINE...") (if (setq ss (ssget "_:L" '((0 . "LWPOLYLINE,LINE")))) (progn (sssetfirst nil ss) (setq s1 (ssget "_I" '((0 . "LWPOLYLINE") (-4 . "&=") (70 . 1) (90 . 4) (-4 . "<not") (-4 . "<>") (42 . 0.0) (-4 . "not>")))) (sssetfirst nil ss) (setq s2 (ssget "_I" '((-4 . "<or") (0 . "LINE") (-4 . "<and") (0 . "LWPOLYLINE") (-4 . "<not") (-4 . "&=") (70 . 1) (-4 . "not>") (90 . 2) (-4 . "<not") (-4 . "<>") (42 . 0.0) (-4 . "not>") (-4 . "and>") (-4 . "or>")))) (sssetfirst) (setq rect (ssname s1 0)) (setq rectx (entget rect)) (setq b1 (ssname s2 0)) (setq b2 (ssname s2 1)) (setq x1 (car (trans (cdr (assoc 10 (entget b1))) (if (= (cdr (assoc 0 (entget b1))) "LINE") 0 rect) 1))) (setq x2 (car (trans (cdr (assoc 10 (entget b2))) (if (= (cdr (assoc 0 (entget b2))) "LINE") 0 rect) 1))) (setq pl (mapcar '(lambda ( p ) (trans (list (car p) (cadr p) (cdr (assoc 38 rectx))) rect 1)) (mapcar 'cdr (vl-remove-if '(lambda ( x ) (/= (car x) 10)) rectx)))) (setq p0 (car (vl-sort pl '(lambda ( a b ) (if (= (car a) (car b)) (< (cadr a) (cadr b)) (< (car a) (car b))))))) (setq p1 (car (vl-remove-if-not '(lambda ( x ) (= (cadr x) (cadr p0)) (> (car x) (car p0))) (vl-remove p0 pl)))) (setq p2 (car (vl-remove-if-not '(lambda ( x ) (= (car x) (car p1)) (> (cadr x) (cadr p0))) (vl-remove p1 (vl-remove p0 pl))))) (setq p3 (car (vl-remove p2 (vl-remove p1 (vl-remove p0 pl))))) (if (< x1 x2) (progn (setq p0 (trans (list x1 (cadr p0)) 1 rect)) (setq p1 (trans (list x2 (cadr p1)) 1 rect)) (setq p2 (trans (list x2 (cadr p2)) 1 rect)) (setq p3 (trans (list x1 (cadr p3)) 1 rect)) ) (progn (setq p0 (trans (list x2 (cadr p0)) 1 rect)) (setq p1 (trans (list x1 (cadr p1)) 1 rect)) (setq p2 (trans (list x1 (cadr p2)) 1 rect)) (setq p3 (trans (list x2 (cadr p3)) 1 rect)) ) ) (setq rectx (append (reverse (member (assoc 39 rectx) (reverse rectx))) (list (cons 10 p0) (cons 10 p1) (cons 10 p2) (cons 10 p3)) (list (assoc 210 rectx)))) (entupd (cdr (assoc -1 (entmod rectx)))) ) ) (princ) ) M.R.
    1 point
×
×
  • Create New...