Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/11/2022 in all areas

  1. Make it a block and scale the x and y axis as desired.
    2 points
  2. Either of these versions will hatch this if its 2 plines. For Sandeep RC if your confident that all the areas are closed in some way either version will work, I exploded the plines so it was all lines and worked fine. ; hatch boundary's ; By AlanH Mar 2022 (defun c:lothatch1 ( / ss x ang ent pt) (setq ss (ssget (list (cons 0 "*TEXT")))) (setq ang 0.0) (setvar 'HPSCALE 5.0) (setvar 'hpname "Ansi31") (repeat (setq x (sslength ss)) (setq pt (cdr (assoc 10 (entget (ssname ss (setq x (1- x))))))) (command "bpoly" pt "") (setq ent (entlast)) (setvar 'hpang ang) (command "-hatch" "S" ent "" "") (setq ang (+ ang 0.25)) (entdel ent) ) (princ) ) (defun c:lothatch2 ( / ss x ang ent pt) (setq ss (ssget (list (cons 0 "*TEXT")))) (setq ang 0.0) (setvar 'HPSCALE 5.0) (setvar 'hpname "Ansi31") (repeat (setq x (sslength ss)) (setq pt (cdr (assoc 10 (entget (ssname ss (setq x (1- x))))))) (setvar 'hpang ang) (command "-hatch" pt "" "") (setq ang (+ ang 0.25)) ; radians ) (princ) )
    1 point
  3. I think like you Mhupp I use Notepad ++ now so for simple code easy to check, if its hundreds of lines I resort to my 1980's check brackets lisp, handy when debugging someone else's code. For a bit of nostalgia ; By Alan H ; circa 1980's (defun c:chkbrk (/ opf bkt chekdfile rdctl wkfile currentln wln ltr ncln) (setvar "cmdecho" 0) (prompt "\nlook at end of line") ;(setq chekdfile (getstring "enter name of file :")) (SETQ chekdfile (getfiled "Enter file name:" " " "LSP" 4)) (setq opf (open chekdfile "r")) (setq bkt 0) (setq blkl 0) (setq rdctl 1) (setq wkfile (open "c:\temp\wow.lsp" "w")) ; change out directory to suit (setq currentln "a") (while (/= blkl 6) (setq currentln (read-line opf)) (if (= currentln nil)(setq currentln "")) (if (= currentln "")(setq blkl (+ 1 blkl))(setq blkl 1)) (setq wln currentln) (while (/= wln "") (setq ltr (substr wln 1 1)) (setq wln (substr wln 2)) (cond ((= (ascii ltr) 34) (if (= rdctl 0)(setq rdctl 1)(setq rdctl 0))) ((and (= ltr "(")(= rdctl 1))(setq bkt (+ bkt 1))) ((and (= ltr ")")(= rdctl 1))(setq bkt (- bkt 1))) ((and (= ltr ";")(= rdctl 1))(setq wln "")) ;(t (prompt ltr)) ) ) (setq ncln (strcat currentln ";" (itoa bkt) (princ (itoa bkt)) (if (= rdctl 0) "string open" ""))) (if (/= currentln "")(write-line ncln wkfile)) ) (close wkfile) (close opf) (prompt (strcat "open brakets= " (itoa bkt) ".")) ) (command "chkbrk") (princ)
    1 point
  4. Here is my attempt in this regard. You can change hatch pattern "ANSI37" to suit yours. (defun c:Test ( / *error* lws int sel ent lst doc cmd zom inc fnd prm ssn pos pts) ;; Tharwat Al Choufi - 9.Mar.2022 ;; (defun *error* (m_) (and doc zom (vla-zoomprevious doc)) (and cmd (setvar 'CMDECHO cmd)) (and m_ (princ "\n*Cancel*")) (princ) ) (and (princ "\nSelect single texts to hatch the boundary they reside in : ") (or (setq lws (ssget "_X" (list '(0 . "LWPOLYLINE") '(-4 . "<AND") '(-4 . "&=") '(70 . 1) '(-4 . "AND>") (cons 410 (getvar 'CTAB))))) (alert "No closed Polylines / Boundaries found in this drawing <!>") ) (setq int -1 sel (ssget '((0 . "TEXT")))) (while (setq int (1+ int) ent (ssname sel int)) (setq lst (cons ent lst)) ) (setq doc (vlax-get-acad-object) cmd (getvar 'CMDECHO) zom (or (vla-zoomextents doc) t)) (setq int -1) (setvar 'CMDECHO 0) (while (and lst (setq int (1+ int) ent (ssname lws int))) (foreach itm (entget ent) (and (= (car itm) 10) (or (vl-position (setq prm (cdr itm)) pts) (setq pts (cons prm pts)))) ) (and (setq inc -1 pos nil fnd (ssget "_WP" pts '((0 . "TEXT")))) (while (and (not pos) (setq inc (1+ inc) ssn (ssname fnd inc))) (and (setq pos (vl-position ssn lst)) (progn (setq lst (vl-remove ssn lst)) (vl-cmdf "_.-hatch" "_S" (ssadd ent) "" "_P" "ANSI37" "1.0" "" "") ) ) ) ) (setq pts nil) ) ) (*error* nil) (princ) ) (vl-load-com)
    1 point
  5. This will hide them. Regen to bring them back. (defun C:ALL-OLE (/ SS) (if (setq SS (ssget "_X" '((0 . "OLE2FRAME")))) (foreach obj (vl-remove-if 'listp (mapcar 'cadr (ssnamex SS))) (redraw obj 2) ;(entdel obj) ;if you just want to delete them ) ) )
    1 point
  6. Yes - although not listed by the dialog for the standard AutoCAD FIELD command, a field expression can actually reference any ActiveX property. As such, you can download & load my Quick Field utility and then define a custom command such as the following to create a field referencing the Moment of Inertia for a selected 3D Solid: (defun c:test ( ) (LM:QuickField "MomentOfInertia" "" 2))
    1 point
  7. It is Ok my friend . Try this code .... (defun c:Test (/ l p1) (if (setq p1 (getpoint "\n Specify point :")) (while (setq l (tblnext "LAYER" (null l))) (entmakex (list '(0 . "LINE") (cons 10 p1) (cons 11 (polar p1 0.0 100.)) (cons 8 (cdr (assoc 2 l))) ) ) (setq p1 (polar p1 (/ pi 2.) 10.)) ) (princ) ) (princ) )
    1 point
×
×
  • Create New...