Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/05/2024 in all areas

  1. Nevermind Brain was tired
    1 point
  2. You are right, this is hardly possible unless you load with (arxload) certain ARX libraries, but you have to know which ones, which is not at all obvious.
    1 point
  3. RonJonP works for me For batch process, another of Lee Macs, scripteditor should do the batch processing OK. BigAl - not sure about Accoreconsole - it sometimes fails with VLA- or VLAX- commands doesn't it? (I tend to use another routine rather than that even if core console is a lot quicker so not sure which it doesn't like)
    1 point
  4. It shouldn't take 20 minutes something not right in the algorithm or is it the dwg ? I do something to hundreds of common objects 4 tasks and takes 2 minutes. It searches no zooming just does it. Yes started coding at 36 minutes but now 2 minutes. I will try to find time for get text, do a bounding box offset it, then use the new offset box does it touch a Pline, if so compare the end points to the insertion point of text, swap end points if required and add a point. Yes if it touches a line a problem but run Join Multi 1st to get around that. "Polylines with different origins (when they are not simple lines)" Need a global fix. Need to find one to see what is going on. This is what I got looking at dwg. Would use select window so no stray text. : (sslength (ssget "X" '((0 . "LINE")(cons 410 (getvar 'ctab))))) 0 : (sslength (ssget "X" '((0 . "MTEXT")(cons 410 (getvar 'ctab))))) 3 : (sslength (ssget "X" '((0 . "TEXT")(cons 410 (getvar 'ctab))))) 318 : (sslength (ssget "X" '((0 . "LWPOLYLINE")(cons 410 (getvar 'ctab))))) 317 Have to go somewhere soon, maybe tonight.
    1 point
  5. (setvar 'BACKGROUNDPLOT 0) It may be helpful to add this to the front of your code.
    1 point
  6. Your file is not homogeneous: Texts, mtexts with fancy formatting in the text itself Polylines with different origins (when they are not simple lines) Since I'm not a magician, I suggest the following (which seems to do most of the work). It's not perfect, but I wouldn't do more for free. The treatment is long (around twenty minutes), a progress bar is displayed. (defun c:test ( / ss_text size i n dxf_txt str l_str p10 ang z pt_lst ent dxf_lw l_vtx pt_ins) (setvar "CMDECHO" 0) (mapcar '(lambda (x / lay) (setq lay (entget (tblobjname "LAYER" x))) (entmod (subst (cons 70 0) (assoc 70 lay) (subst (cons 62 (abs (cdr (assoc 62 lay)))) (assoc 62 lay) lay ) ) ) ) '("GLine" "GText") ) (mapcar '(lambda (x y) (if (not (tblsearch "LAYER" x)) (entmake (list '(0 . "LAYER") '(100 . "AcDbSymbolTableRecord") '(100 . "AcDbLayerTableRecord") (cons 2 x) '(70 . 0) (cons 62 y) '(6 . "Continuous") '(290 . 1) '(370 . -3) ) ) ) ) '("GLine2" "GPoint2" "GText2") '(2 5 1) ) (command "_.zoom" "_extent") (setq ss_text (ssget '((0 . "*TEXT") (8 . "GText")))) (cond (ss_text (setvar "PDMODE" 68) (setvar "PDSIZE" 1) (setq size (sslength ss_text) i 0) (acet-ui-progress-init "Working:" size) (repeat (setq n (sslength ss_text)) (acet-ui-progress-safe (setq i (1+ i))) (setq dxf_txt (entget (ssname ss_text (setq n (1- n)))) str (cdr (assoc 1 dxf_txt)) ) (if (and (eq (cdr (assoc 0 dxf_txt)) "MTEXT") (vl-string-position 59 str nil T)) (setq str (substr str (+ 2 (vl-string-position 59 str nil T)))) ) (setq l_str (vl-string->list str)) (foreach el l_str (if (not (member el '(46 48 49 50 51 52 53 54 55 56 57))) (setq l_str (vl-remove el l_str)) ) ) (setq str (vl-list->string l_str) ang (cdr (assoc 50 dxf_txt)) p10 (if (eq (cdr (assoc 0 dxf_txt)) "MTEXT") (cdr (assoc 10 dxf_txt)) (polar (cdr (assoc 10 dxf_txt)) ang 1.92199) ) z (atof str) pt_lst (list p10 (polar p10 (- ang (* 0.5 pi)) (+ 0.45 (if (eq (cdr (assoc 0 dxf_txt)) "MTEXT") (cdr (assoc 43 dxf_txt)) (cdr (assoc 40 dxf_txt)) ) ) ) ) ) (command "_.zoom" "_ce" (cadr pt_lst) 10) (setq ss_pl (ssget "_F" pt_lst '((0 . "LWPOLYLINE") (8 . "GLine")) ) ) (cond ((and ss_pl (eq (sslength ss_pl) 1)) (setq ent (ssname ss_pl 0) dxf_lw (entget ent) l_vtx (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) dxf_lw)) ) (if (equal (angle (car l_vtx) (cadr l_vtx)) ang 1E-03) (setq pt_ins (caddr l_vtx)) (setq pt_ins (car l_vtx)) ) (cond ((and z pt_ins) (entmod (subst (cons 8 "GLine2") (assoc 8 dxf_lw) dxf_lw)) (entmod (subst (cons 8 "GText2") (assoc 8 dxf_txt) dxf_txt)) (entmake (list '(0 . "POINT") '(100 . "AcDbEntity") '(67 . 0) '(410 . "Model") '(8 . "GPoint2") '(100 . "AcDbPoint") (cons 10 (list (car pt_ins) (cadr pt_ins) z)) '(210 0.0 0.0 1.0) '(50 . 0.0) ) ) (setq z nil pt_ins nil sspl nil) ) ) ) (T (setq z nil pt_ins nil sspl nil)) ) ) (acet-ui-progress-done) ) (command "_.zoom" "_extent") ) (setvar "CMDECHO" 1) (prin1) )
    1 point
  7. Sorry but why not use command ? We have been using this for years it will just flash before your eyes as it makes pdfs. I guess could convert command to vl but realistically don't think there will be any significant speed gain. Switching between layouts it takes like less than 1 second to make a pdf. That includes opening in the PDF viewer. For us it was a menu choice click the button and just watch it happen. Just tested on real dwg 15 layouts took 6 seconds. What is not fast enough about that ?
    1 point
  8. Please use Code Tags for your code. (Click the <> in the editor toolbar.)
    1 point
  9. Since you're from PA and I've got close ties to Mars (Mars, PA that is), try this No error control and the layer needs to be in the dwg (defun c:test () (vl-load-com) (setq bas (getreal "Enter base elevation: ") ci5 (* 5 (getreal "Enter contour interval: "));every 5th contour indexed ss (ssget '((0 . "*polyline"))) idx -1 ) (repeat (sslength ss) (setq obj (vlax-ename->vla-object (ssname ss (setq idx (1+ idx))))) (if (zerop (rem (vlax-get obj 'Elevation) ci5)) (vlax-put obj 'Layer "CONT-IDX");change layer name to suit ) ) (princ) )
    1 point
  10. Dang. Is the guy above the best dude you ever met or what? Where else could you go to get such good service? AutoDesk? I DON'T THINK SO!
    1 point
×
×
  • Create New...