Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/20/2025 in Posts

  1. Respectfully Disagree. I understand where you're going with this, but imagine trying to code in .Net, C++, etc. without a good IDE. Better to use the tools out there that are free and easy! Personally I am kinda rogue - I use PSPad with the syntax file that I have been maintaining for the developer. PSPad is not perfect, but I know it very well and can work quickly in it. Notepad++ is also an excellent editor. There are several other that also work well, depending on the preference of the user. For newbies, I would say use VS Code - It is a good editor and will always be up to date with all the internal functions.
    1 point
  2. i got it figured out, this is what it is for reference: this used our variables we created years ago. Thank you for your help. ^C^C._ZOOM;_E;_fillet;radius;0.0625;chamfera;0.0625;_chamferb;0.0625;dimasz;0.0625;dimcen;0;dimdli;0;dimexe;0.0625;dimexo;0.0625;dimgap;0.0625;dimtxt;0.1;donutid;0;donutod;0.5;gridunit;1,1;hpscale;0.25;hpspace;0.25;ltscale;0.208;offsetdist;1;snapunit;1,1;textsize;0.1;dimclrt;7;limits;0,0;36,24;dimscale;1;_chamfera;0.0625;chamferb;0.0625;dimasz;0.0625;dimcen;0;dimdli;0;dimexe;0.0625;dimexo;0.0625;dimgap;0.0625;dimtxt;0.1;donutid;0;donutod;0.5;gridunit;1,1;hpscale;0.25;hpspace;0.25;ltscale;0.208;offsetdist;1;snapunit;1,1;textsize;0.1;dimclrt;7;limits;0,0;36,24;getvar;dimscale;1;_QSAVE;$M=$(if,$(eq,$(getvar,DWGTITLED),0),~);._CLOSE;
    1 point
  3. Note: the only geometries considered in the code are the "LINE" and "ARC" objects.
    1 point
  4. Hi I've never experimented with the 'divide' command before. Or at least I don't remember when I last did. So I've been inspired by Bigal's code idea to make a slightly different version. In my case, 'divide' always makes the marks on the left side of the lines and inside the arcs. For this reason I decided to write some code to enable, in any case, the usefulness of this command. I'm leaving it here, in case it's useful to you. (defun c:tics (/ ent ptS creaBlq ptDir creaBlq entUlt ang angBase lstent borraCodigos tipObj entUlt comprbaLado) (defun creaBlq (nombre) (entmake (list (cons 0 "BLOCK") '(10 0.0 0.0 0.0) (cons 2 nombre) '(70 . 0))) (entmake '((0 . "LINE") (8 . "0") (10 0.0 0.0 0.0) (11 0.0 3.0 0.0))) (entmake (list (cons 0 "ENDBLK") (cons 8 "0"))) ) (defun borraCodigos (lstCodigos lstent / lst lst1) (foreach lst lstent (if (not (member (car lst) lstCodigos)) (setq lst1 (append lst1 (list lst))) ) ) lst1 ) (defun comprbaLado (lstEntobjBase / ent lstent lstEnts ptCen invertir?) (while (not (equal (setq ent (entlast)) entUlt)) (setq lstEnts (append lstEnts (list (vl-remove-if-not (function (lambda (x) (member (car x) '(0 8 2 10 11 40 50)))) (entget ent))))) (entdel ent) ) (foreach lst lstEnts (entmake (subst (cons 50 (+ (cdr (assoc 50 lst)) pi)) (assoc 50 lst) lst)) ) ) (if (not (tblsearch "BLOCK" "Muesca")) (creaBlq "Muesca") ) (while (setq ent (entsel "\nPick object near left end press Enter to exit ") ) (setq ptS (cadr ent) ent (car ent)) (setq ptDir (getpoint ptS "\nSelect the side on which to act...")) (if (= (setq tipObj (cdr (assoc 0 (setq lstent (entget ent))))) "LINE") (if (and (> (setq ang (angle ptDir (cdr (assoc 11 lstent)))) (setq angBase (angle (cdr (assoc 10 lstent)) (cdr (assoc 11 lstent)) ) ) ) (< ang (+ angBase pi)) ) (progn (entmod (append (borraCodigos '(10 11) lstent) (list (cons 10 (cdr (assoc 11 lstent))) (cons 11 (cdr (assoc 10 lstent)))) ) ) ) ) ) (setq entUlt (entlast)) (command "_divide" ent "_B" "Muesca" "_Y" (getint "Howmany tics ") ) (if (member tipObj '("ARC" "CIRCLE")) (if (> (distance ptDir (setq ptCen (cdr (assoc 10 lstent)))) (setq radio (cdr (assoc 40 lstent)))); es decir, si el lado seleccionado es el exterior (comprbaLado lstent) ) ) ) (princ) )
    1 point
  5. Then there's polyline bulges CurveCurveInt3d seems to correctly identify bulges that overlap import traceback from pyrx import Rx, Ge, Gi, Db, Ap, Ed, Ax @Ap.Command() def doit(): try: filter = [(Db.DxfCode.kDxfStart, "*LINE")] ps, ss = Ed.Editor.selectPrompt("Add lines: ", "Remove lines: ", filter) if ps != Ed.PromptStatus.eOk: raise RuntimeError("Selection Error! {}: ".format(ps)) curves = [Db.Curve(id) for id in ss.objectIds()] for crv1 in curves: for crv2 in curves: if crv1 == crv2: continue gec1 = crv1.getAcGeCurve() gec2 = crv2.getAcGeCurve() cci = Ge.CurveCurveInt3d(gec1, gec2) for idx in range(cci.overlapCount()): iv1, iv2 = cci.getOverlapRanges(idx) Ed.Core.grDrawCircle(crv1.getPointAtDist(iv1.lowerBound()),1,20,1) Ed.Core.grDrawCircle(crv1.getPointAtDist(iv1.upperBound()),1,20,1) except Exception as err: traceback.print_exception(err)
    1 point
  6. Had this laying around sounds like what you want to do. used it mostly on circles but will work on any entity. it calculates the mid point so might want to replace line 8 - 11 with just a getpoint. COB.lsp
    1 point
  7. How big is your printer? Sound like you have PSLTSCALE turned off.
    1 point
  8. Possible 2 problems you can not use a variable name of "t" this is interpreted as the system variable TRUE, use say Tval. The other is Mtext may be a better way to go. (command "_mtext" p13 p13 (strcat "RISER " (rtos rh 2 3) "\n" "TREAD " (rtos tval 2 3)))
    1 point
  9. Copied and pasted from my Lisp Library: The first are useful functions to have to hand. For example "ZA" - Zoom All I use all the time in preference to "Zoom" "All" "Closer" closes document, no save "VPScale" sets all viewports to 1:1 scale in that sheet Put together in MyClose at the end. Load them all up and it should be OK ;;;;SubFunctions, Useful to have anyway;;;; ;;;;Zooms: ZE - extents, ZA - All, ZO - Object, ZP - Previous (defun c:ze() ;;Zooms extents, then zooms out 0.95x (command "zoom" "e" "zoom" ".95x")(princ) ) (defun c:za() ;;Zoom all, then zooms out 0.95x (command "zoom" "a" "zoom" ".95x")(princ) ) (defun c:zo() ;;Zoom object (command "zoom" "o" "zoom" "0.95x")(princ) ) (defun c:zp() ;;Zoom previous (command "zoom" "p")(princ) ) ;;;;asave: Save Lisp (defun c:asave( / currentversion saveasversion old) (setq vars '("CMDECHO" "FILEDIA")) ;;Disable command promts and echo vars (setq old (mapcar 'getvar vars)) ;;Record current vars (mapcar 'setvar vars '(0 0)) ;; Change vars (if (= 1 (getvar "dwgtitled"))(command "qsave")) ;; EXISTING DRAWING (if (= 0 (getvar "dwgtitled")) (COMMAND "_.saveas" "" "~") ) ;;new drawing (mapcar 'setvar vars old) ;;reset command prompt and echo (princ) ) ;;;;closer: Closes drawing, no save (defun c:closer( / *doc* opendrawings) (if (= dbmod 0)(command ".close")) ;; Close if drawing is saved (if (/= dbmod 0)(command ".close" "y")) ;; Close if drawing is not saved ) ;;;; VPScale: Sets all viewports in sheet to 1:1 (defun c:VPScale ( / MySS scale acount) (setq MySS (ssget "_X" '((0 . "VIEWPORT")))) ;; Select all viewports (setq acount 0) ;; A counter (setq scale 1) ;;1 = 1:1 ;; Scale to use (while (< acount (sslength MySS)) ;; loop through selection set (vla-put-customscale (vlax-ename->vla-object (ssname MySS acount)) scale) ;; Set viewports scales (setq acount (+ acount 1)) ) ; end while ) ;;;;; End sub routines ;;;;; ;;;;Zoom extents, all viewports to 1:1, save, close (defun C:MyClose ( / LayList CurrentLay Lay) (setq LayList (layoutlist)) ;; Get layout List (ACAD 2023+) (setq CurrentLay (getvar "ctab")) ;; Record current layout (foreach Lay LayList ;; Loop through each layout (setvar "ctab" Lay) ;; Change layout (c:ZE) ;; Run ZE: Zoom Extents (above) (c:vpscale) ;; Run VPScale, set all viewports to 1:1 ) ; end foreach ;; End loop (setvar "ctab" CurrentLay) ;; Return to previous sheet (c:asave) ;; Save (c:closer) ;; Close )
    1 point
  10. I edited something at the last minute. You may need to copy the code again
    1 point
  11. Ok thought they were plines so much easier to solve just pick left side this gives a direction of the line or arc so added tick goes in correct direction. Bit busy at the moment. You can not auto solve as it depends on the direction of the objects wether it goes left or right. You can though use divide and a block, which is the approach I will use. Ok this is a crude way to do the task. Note I made a Block called "Ticker" it was a 2 unit long line drawn vertically from 0,0 with insertion point 0,0. (defun c:tics ( / ent pt3 start end d1 d2) (while (setq ent (entsel "\nPick object near left end press Enter to exit ")) (setq pt3 (cadr ent)) (setq cent (car ent)) (setq obj (vlax-ename->vla-object cent)) (setq start (vlax-curve-getstartPoint obj)) (setq end (vlax-curve-getEndPoint obj)) (setq d1 (distance pt3 end)) (setq d2 (distance pt3 start)) (if (< d1 d2) (progn (command "pedit" cent "r" "") (command "explode"(entlast) "") ) ) (command "divide" pt3 "B" "Ticker" "Y" (getint "Howmany tics ")) ) (princ) ) Look at image the 2 points to pick to have tics go in. They need left corner even when looking upside down. I can add the number of tics so that is not asked repeatedly. Change the size of the tics to what you want. The use of Pedit Reverse is because Bricscad does not have a "Reverse" command.
    1 point
×
×
  • Create New...