Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/14/2023 in all areas

  1. Hello friends, Running a forum like this often feels like a long-running battle against those who would like to deface or destroy what we do here. From time-to-time we need to change the way we operate to stay one step ahead of the hackers and haters. From today, the way you login to this forum will change. Historically, you've been able to login using your screen name and password. The problem with this approach is that your screen name is publicly available, so all a hacker has to do is to find your password. From today, you will not be able to login using your screen name, you will need to use the email address associated with your account. Since your email address is not publicly available, this change presents a significant defense against hackers. If you already login using your email address, you do not need to change the way you login. We recommend that you always use a strong password to avoid your account being hacked.
    1 point
  2. I did to suit your sample, I will add some feature so to not unbold the unbolded text.
    1 point
  3. wow! man you have done it! it is perfect! thank you so much, slow claps to you sir!
    1 point
  4. From ® 2004.06.26, Stig Madsen v.0.95 CHAMFERA chamfer,distance,fillet Read-write,Real,Drawing 0.5000 Sets the first chamfer distance. 0 CHAMFERB chamfer,distance,fillet Read-write,Real,Drawing 0.5000 Sets the second chamfer distance. 0 CHAMFERC chamfer,lenght,fillet Read-write,Real,Drawing 1.0000 Sets the chamfer length. 0 CHAMFERD chamfer,angle,fillet Read-write,Real,Drawing 0.0000 Sets the chamfer angle. 0 CHAMMODE chamfer,distance,angle Read-write,Integer,Not saved 0 Sets the input method by which AutoCAD creates chamfers. 2 #0,Requires two chamfer distances #1,Requires one chamfer distance and an angle
    1 point
  5. Had another look at this, happier with it now. A question though, does anyone know the variable name for the standard chamfer distance - was thinking to use that and update that for the chamfer distance in here. (defun c:test ( / chdist coords1 coords2 pline NL1 NL2 NL3 NL3PtA NL3 PtB int ptsa) ;;https://forums.autodesk.com/t5/autocad-forum/break-at-point/td-p/7553581 (defun BAP ( entity point /) (setq entity (list entity point)) ; recreate entsel.... Added this line (command "_.break" entity "_F" "_non" point "_non" point) ) (defun MakeLine ( con10 con11 / ) (entmakex (append (list (cons 0 "LINE") (cons 100 "AcDbEntity") (cons 100 "AcDbLine") (cons 10 con10) (cons 11 con11) )) ) ) ;;https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/select-polyline-segment/td-p/1758253 (defun test ( pt / elst ename pt param preparam postparam) ; returns selected line coordinates (setq elst (nentselp pt)) (if (= (cdr (assoc 0 (entget (car elst)))) "LINE") (progn (list (cdr (assoc 10 (entget (car elst))))(cdr (assoc 11 (entget (car elst)))) elst) ) ; end progn (progn (setq ename (car elst)) (setq pt (cadr elst)) (setq pt (vlax-curve-getClosestPointTo ename pt)) (setq param (vlax-curve-getParamAtPoint ename pt)) (setq preparam (fix param)) (setq postparam (1+ preparam)) (list (vlax-curve-getPointAtParam ename preparam) (vlax-curve-getPointAtParam ename postparam) elst ) ) ; end progn ) ; end if ) (defun trimlinetopt ( MyLine TrimPt1 TrimPt2 / MyLineDef MyLineEndA MyLineEndB Pt1Dist Pt2Dist TempPT MyLineA MyLineB) (command "zoom" "Object" MyLine "") (command "zoom" "0.95x") (setq MyLineDef (entget MyLine)) (setq MyLineEndA (cdr (assoc 10 MyLineDef))) (if (= (cdr (assoc 0 MyLineDef)) "LINE") (setq MyLineEndB (cdr (assoc 11 MyLineDef))) (setq MyLineEndB (cdr (assoc 10 (reverse MyLineDef)))) ) ;;sort trimpts according to distance from end A (setq Pt1Dist (vlax-curve-getdistatpoint MyLine (osnap TrimPt1 "nea")) ) (setq Pt2Dist (vlax-curve-getdistatpoint MyLine (osnap TrimPt2 "nea")) ) (if ( > Pt1Dist Pt2Dist) (progn (setq TempPt TrimPt1) (setq TrimPt1 TrimPt2) (setq TrimPt2 TempPt) ) ;end progn ) ;end if (BAP MyLine TrimPt1) (setq MyLineA (entlast)) (BAP MyLineA TrimPt2) (setq MyLineB (entlast)) (entdel MyLineA) (command "zoom" "Previous") (command "zoom" "Previous") MyLineA ) ;;; add here something nice like "select lines or [option]" (setq thisdrawing (vla-get-activedocument (vlax-get-acad-object))) (vla-startundomark thisdrawing) (setq chdist (getreal (strcat "Enter Chamfer Distance (" (rtos (getvar "CHAMFERA")) "): "))) (if (= chdist nil) (setq chdist (getvar "CHAMFERA")) (progn (setvar "chamfera" chdist) (setvar "chamferb" chdist) ) ) (setq pt1 (cadr (entsel "\nSelect Line or Segment 1"))) (setq coords1 (test pt1)) (setq pline1 (car (last coords1))) (setq chdisttemp 0) (princ "Select Line or Segment 2") (command "chamfer" (cadr (last coords1)) "Distance" chdisttemp chdisttemp (setq pt2 (getpoint)) ) (setq coords2 (test pt2)) (setq pline2 (car (last coords2))) (setq NL1 (makeline (car coords1) (cadr coords1)) ); templine 1 (setq NL2 (makeline (car coords2) (cadr coords2)) ); templine 2 ;; (command "chamfer" NL1 "Distance" chdist chdist NL2) (command "chamfer" pt1 "Distance" chdist chdist pt2) (setq NL3 (entlast)) (setq NL3PtA (cdr (assoc 10 (entget NL3))) ) (setq NL3PtB (cdr (assoc 11 (entget NL3))) ) (command "move" NL1 "" NL3PtA NL3PtB ) (command "move" NL2 "" NL3PtB NL3PtA ) (if (and (= (cdr (assoc 0 (entget pline1))) "LINE") (= (cdr (assoc 0 (entget pline2))) "LINE")) (setq MyType "Line") (setq MyType "Polyline") ) ; end if (command "extend" NL1 NL2 "" NL1 NL2 "") (setq int (vLa-intersectwith (vLax-ename->vLa-Object NL1) (vLax-ename->vLa-Object NL2) acextendnone) ) (setq ptsa (vLax-safearray->List (vLax-variant-vaLue int))) (entdel NL1) (entdel NL2) (setq NL1 (makeline ptsa NL3PtA) ); templine 3 (setq NL2 (makeline ptsa NL3PtB) ); templine 4 (entdel NL3) (cond ((= MyType "Line") (command "chamfer" NL1 "Distance" chdisttemp chdisttemp pline1) (command "chamfer" NL2 "Distance" chdisttemp chdisttemp pline2) ) ((= MyType "Polyline") (setq coords1 (test pt1)) (setq pline1 (car (last coords1))) (trimlinetopt pline1 NL3PtA NL3PtB) (command "join" pline1 (entlast) NL1 NL2 "") ) ) ; end conds (setvar "chamfera" chdist) (setvar "chamferb" chdist) (vla-endundomark thisdrawing) (princ) )
    1 point
  6. So you cut and offset several circles. If you want each form to be distinct, switch to a different layer and use the BPOLY command to create brand-new plines that are shaped like the two arcs but with ends. Simply choose a spot between the two arcs.
    1 point
  7. This. but it doesn't solve the problem just makes one big selection set. (setq SS (ssget '((0 . "*TEXT,DIMENSION") (1 . "*#*,~*@*")))) Need to find the entities that are only in both selection sets. texts that have numbers but don't have any letters. and unless your going to process a lot of text. I think it might be a wash. Since distof weeds out the text you can't use. but you can look at this and pull a few functions so you can process text that have letters and numbers. (if (setq SS (ssget '((0 . "*TEXT,DIMENSION") (1 . "*#*")))) (progn (if (setq SS1 (ssget "_P" '((0 . "*TEXT,DIMENSION") (1 . "~*@*")))) (foreach text (vl-remove-if 'listp (mapcar 'cadr (ssnamex SS1))) (if (ssmemb text ss) (ssadd text ss2) ) ) ) ) )
    1 point
  8. Don't need to limit things not no locked layers since your just reading the values, and (0 . "TEXT,MTEXT") can be shorted to just (0 . "*TEXT") This will allow you to select any text. it will only add up text that is only numbers. since distof will only work if the string is only numbers. ;;----------------------------------------------------------------------------;; ;;Sum of selected text that is only numbers (defun C:foo (/ sum ss) (setq sum 0) (setq SS (ssget '((0 . "*TEXT") (1 . "*#*")))) (foreach text (vl-remove-if 'listp (mapcar 'cadr (ssnamex SS))) (if (setq x (distof (cdr (assoc 1 (entget text)))) (setq sum (+ x sum)) ) ) ) (entmake (list (cons 0 "TEXT") (cons 1 (rtos sum 2 3)) (cons 10 (getpoint)) (cons 40 (getvar "TEXTSIZE")))) (princ) )
    1 point
  9. If you are drawing it --- use Colin Perssons fool-proof SNAPS.
    1 point
  10. I don't have zwcad and never used it so not sure if its compatible with visual lisp. Maybe there lies your problem because this is mainly a forum for AutoCad. But I tested it on my own system (AutoCad2022) and for me it works. (defun c:RlxOdbxDeleteXref (/ _getfolder dbx_ver app dbxv folder xref-name ) (vl-load-com) (defun _getfolder ( m / sh f r ) (setq sh (vla-getinterfaceobject (vlax-get-acad-object) "Shell.Application") f (vlax-invoke-method sh 'browseforfolder 0 m 0)) (vlax-release-object sh)(if f (progn (setq r (vlax-get-property (vlax-get-property f 'self) 'path))(if (wcmatch r "*\\") r (strcat r "\\"))))) (defun dbx_ver ( / v) (strcat "objectdbx.axdbdocument" (if (< (setq v (atoi (getvar 'acadver))) 16) "" (strcat "." (itoa v))))) (defun void (x) (or (not x) (= "" x) (and (eq 'STR (type x)) (not (vl-remove 32 (vl-string->list x)))))) (setq app (vlax-get-acad-object) dbxv (dbx_ver)) (cond ((void (setq xref-name (getstring "\nEnter name of xref you want to detach : "))) (princ "\nComputer says no : invalid xref name")) ((vl-catch-all-error-p (setq odbx (vl-catch-all-apply 'vla-getinterfaceobject (list app dbxv)))) (princ "\nObject DBX interface not created!")) ((setq folder (_getfolder "Select folder with drawings to delete (ALL) xrefs")) (setq xref-name (strcase xref-name)) (foreach dwg (vl-directory-files folder "*.dwg" 0) (setq dwg (strcat folder dwg)) (if (vl-catch-all-error-p (vl-catch-all-apply 'vla-open (list odbx dwg))) (princ (strcase (strcat "\nError opening: " dwg))) (progn (princ (strcat "\nOpening: " dwg)) ;;; seek & destroy (all) xrefs (vlax-for lt (vla-get-layouts odbx) (vlax-for blkobj (vla-get-block lt) (if (and (eq (vla-get-objectname blkobj) "AcDbBlockReference") (vlax-property-available-p blkobj 'Path) (eq xref-name (strcase (vl-filename-base (vla-get-name blkobj)) t)) ) (vlax-invoke-method blkobj 'Delete) ) ) ) ; save drawing (vla-saveas odbx (vla-get-name odbx)) );end progn );end if (princ "\nDone") ); end foreach ); end setq folder (t (princ "\nComputer says no")) ); end cond (vl-catch-all-apply 'vlax-release-object (list app)) (vl-catch-all-apply 'vlax-release-object (list odbx)) (princ) )
    1 point
×
×
  • Create New...