Jump to content

All Activity

This stream auto-updates

  1. Past hour
  2. You should remove your other post. It is confusing to have two posts. I sorted all the blocks in that dwg. Still not sure your criteria for changing which attribute value. (("DATAPORT NUMBER" "APPLE" "" "1200" "1" "") ("DATAPORT NUMBER" "Box" "" "1250" "" "") ("DATAPORT NUMBER" "Box" "" "1250" "" "") ("DATAPORT NUMBER" "CHERRY" "" "1200" "001" "Yesterday") ("DATAPORT NUMBER" "Cheeze" "" "1800.9" "1" "Now") ("DATAPORT NUMBER" "Chocolates" "" "1350" "" "") ("DATAPORT NUMBER" "DD3" "" "1000" "001" "") ("DATAPORT NUMBER" "Milk" "" "1700" "1" "Never") ("DATAPORT NUMBER" "Milk" "" "1700" "1" "Never") ("DATAPORT NUMBER" "PEACH" "" "1200" "001" "Tomorrow") ("DATAPORT NUMBER" "PEACH" "" "1200" "001" "Tomorrow") ("DATAPORT NUMBER" "PEAR" "" "1200" "001" "Tomorrow") ("DATAPORT NUMBER" "PIE" "" "1100" "003" "") ("DATAPORT NUMBER" "PIE" "" "1100" "003" "") ("DATAPORT NUMBER" "Picles" "" "1400" "" "") ("DATAPORT NUMBER" "Yogurt" "" "1800.9" "2" ""))
  3. BIGAL

    sorting by block attributes

    I posted elsewhere about sorting attributes say up to 5 attributes deep and a list Is made, the next step is the list is counted so the same block attributes have a count added. Eg (002 1100 001 3) so 3 the same exists. Your other post ? So in your data you have say 2 x Box, milk, peach and so on. So what do you do to fix ? (("DATAPORT NUMBER" "APPLE" "" "1200" "1" "") ("DATAPORT NUMBER" "Box" "" "1250" "" "") ("DATAPORT NUMBER" "Box" "" "1250" "" "") ("DATAPORT NUMBER" "CHERRY" "" "1200" "001" "Yesterday") ("DATAPORT NUMBER" "Cheeze" "" "1800.9" "1" "Now") ("DATAPORT NUMBER" "Chocolates" "" "1350" "" "") ("DATAPORT NUMBER" "DD3" "" "1000" "001" "") ("DATAPORT NUMBER" "Milk" "" "1700" "1" "Never") ("DATAPORT NUMBER" "Milk" "" "1700" "1" "Never") ("DATAPORT NUMBER" "PEACH" "" "1200" "001" "Tomorrow") ("DATAPORT NUMBER" "PEACH" "" "1200" "001" "Tomorrow") ("DATAPORT NUMBER" "PEAR" "" "1200" "001" "Tomorrow") ("DATAPORT NUMBER" "PIE" "" "1100" "003" "") ("DATAPORT NUMBER" "PIE" "" "1100" "003" "") ("DATAPORT NUMBER" "Picles" "" "1400" "" "") ("DATAPORT NUMBER" "Yogurt" "" "1800.9" "2" ""))
  4. delta

    Autocad join command

    Thank you for your advice
  5. delta

    Autocad join command

    Thank you very much. That works perfectly
  6. delta

    Autocad join command

    You can null these 2 defuns
  7. Yesterday
  8. The user can always activate the object snapping option using F3. The reason I left this option is in case the user ever needs to reference the geometry of other nearby objects.
  9. Why not use (setvar 'osmode 512) ; as per NEAREST (setq pt1 (getpoint "\nSelect the first break point: ") ;; Entering the first break point pt2 (getpoint "\nSelect the second break point: ") ;; Entering the second break point ep nil ) So point will be at select entity and not need to get the closestpoint (setq pt1 (vlax-curve-getClosestPointTo (vlax-ename->vla-object ent) pt1) pt2 (vlax-curve-getClosestPointTo (vlax-ename->vla-object ent) pt2) )
  10. devitg

    Autocad join command

    use this PEDIT WAY (command "._PEDIT" topline "_J" "all" "" "" ) ;topline infilHL bottomline infilHR "" "_j" "" "")
  11. devitg

    Autocad join command

    Please upload this defun (savevartoold) (infilpanellayer)
  12. mhupp

    Autocad join command

    Read up on cond. better way to test/decide what block to insert. (cond ((and (>= dist1 145) (< dist1 220)) (command "-insert" "*Infil_sq_1" p7 "" "" "") ) ((and (>= dist1 220) (< dist1 295)) (command "-insert" "*Infil_sq_2" p7 "" "" "") ) ((and (>= dist1 295) (< dist1 370)) (command "-insert" "*Infil_sq_3" p7 "" "" "") ) ... ((and(>= dist1 1195) (< dist1 1270)) (command "-insert" "*Infil_sq_15" p7 "" "" "") ) (T ;if all other condtions fail (alert "\nDistance Greater than 1270") ) )
  13. delta

    Autocad join command

    Hi All. This time I have included my files to give you a better idea of what i'm trying to acheive Thanks for the ideas. I have used the PEDIT approach and it has almost worked. It joins 3 of the entities but not the 4th. The program runs right through. Any ideas why the 4th entity won't join?? Ive included my DWG file for you to have a look and also my lisp routine. The bulk of the routine works well its just the join command Regards tony Horozontal Infil.lsp Infil Panels AutoLisp Test.dwg
  14. I got to thinking.. if blocks represent parts and multiple similar Parts exists the same assigned number should be same for similar parts. So after adding Part_Number attribute could the lisp runs the below results? (graphically like column order in a table, but the way the order lisp sorts). I see issues if Part_Number and other Sort Orders values don't match when hoping for blocks with same part number to be assigned same Dataport Number. So there would need to be a warning if that occurs. Hope this makes sense. DATAPORT_NUMBER --> order by--> | Sort_Order | Sort_Order2 | Sort_Order3 | <--Part_Number "001" --> "1000" "001" "" <-- "DD3" "002" -->"1100" "003" "" <-- "PIE" "002" -->"1100" "003" "" <-- "PIE" "003" -->"1200" "1" "" <-- "APPLE" "004" -->"1200" "001" "Tomorrow" <--"PEAR" "005" --> "1200" "001" "Tomorrow"<--"PEACH" "005" -->"1200" "001" "Tomorrow" <--"PEACH" "006" -->"1200" "001" "Yesterday" <--"CHERRY" "007" -->"1250" "" "" <--Box "007" -->"1250" "" "" <--Box "008"-->"1350" "" "" <- Chocolates "009" -->"1400" "" "" <--Pickles etc PNO TEST-LSP FOR NUMBING3.dwg
  15. u4ea2u2

    sorting by block attributes

    I got to thinking.. if blocks represent parts and multiple similar Parts exists the same assigned number should be same for similar parts. So after adding Part_Number attribute could the lisp runs the below results? (graphically like column order in a table, but the way the order lisp sorts). I see issues if Part_Number and other Sort Orders values don't match when hoping for blocks with same part number to be assigned same Dataport Number. So there would need to be a warning if that occurs. Hope this makes sense. DATAPORT_NUMBER --> order by--> | Sort_Order | Sort_Order2 | Sort_Order3 | <--Part_Number "001" --> "1000" "001" "" <-- "DD3" "002" -->"1100" "003" "" <-- "PIE" "002" -->"1100" "003" "" <-- "PIE" "003" -->"1200" "1" "" <-- "APPLE" "004" -->"1200" "001" "Tomorrow" <--"PEAR" "005" --> "1200" "001" "Tomorrow"<--"PEACH" "005" -->"1200" "001" "Tomorrow" <--"PEACH" "006" -->"1200" "001" "Yesterday" <--"CHERRY" "007" -->"1250" "" "" <--Box "007" -->"1250" "" "" <--Box "008"-->"1350" "" "" <- Chocolates "009" -->"1400" "" "" <--Pickles etc PNO TEST-LSP FOR NUMBING3.dwg
  16. I created a new post for this topic. Attributes be added to factor the outcome of Incremental numbers.
  17. @GLAVCVS Thank you very much, as always, you are very attentive to details. It is very convenient that the functions work in a loop and a dashed line is created immediately. "But in the end, I decided to spend a little time improving the code". The code has been improved by 100 percent!
  18. Yes.. the layout you show is what I was thinking of. Attached here is the PNO lisp from earlier in this thread that I was hoping could be altered to do that. Thanks pno.LSP
  19. Last week
  20. Thanks Bigal for looking into this. The goal is to have incremental number input into Attribute "Port_Number" based on level of priority..Sort_Order then Sort_Order2 then Sort_order3. The first and second attributes would always have a value, but the third attribute may at time be empty. Ideally when many blocks that share the same values in the 1st 2 attributes, the lisp looks to the 3rd for direction for the next incremental number assignment.
  21. To Admin this is really a new task, as its the posters first post. Does not match this post. You can sort multiple attributes in a order of attributes. I have some thing that works for up to 5 attributes deep. It pads missing attrbute values, so can have say 1 or up to 4 attribute values. I need some time to have a look at say add a "002" block and find highest attribute value of existing blocks. ("DATAPORT NUMBER" "001" "1000" "001" "") ("DATAPORT NUMBER" "002" "1200" "002" "") ("DATAPORT NUMBER" "002" "1200" "002" "Tomorrow") ("DATAPORT NUMBER" "002" "1200" "002" "Yesterday") ("DATAPORT NUMBER" "003" "1200" "001" "") ("DATAPORT NUMBER" "004" "1350" "" "") ("DATAPORT NUMBER" "005" "1400" "" "") ("DATAPORT NUMBER" "006" "1500" "" "") ("DATAPORT NUMBER" "007" "1600" "" "") ("DATAPORT NUMBER" "008" "1700" "" "") ("DATAPORT NUMBER" "009" "1800.9" "" "") ("DATAPORT NUMBER" "010" "1900" "" ""))
  22. Another important detail: in the circles, the resulting arc that will be modified depends on whether the cut points are indicated in a clockwise or counterclockwise direction. If they are selected in the opposite direction from what is needed to obtain the desired result, it can be immediately switched by pressing TAB key (as indicated in the command line).
  23. I think I read your first explanation too quickly. I also thought about keeping the main part of your code to avoid overcomplicating my answer. But in the end, I decided to spend a little time improving the code. Here's another option for doing this task. One possible difference (or not) with the other options discussed in this thread is that the cut points may or may not be on the object to be cut: when they aren't, it will calculate the perpendicular point. Another small difference is that here, you're still required to first select the object to be modified to avoid the problem of cases where several objects coincide at the same point. (defun c:Br2ptReplDash (/ para tl ss pt1 pt2 p1 p2 ent vlae ep to c r eumk entdata newent entUlt osmant ecoA lstChg lstR lent1 lent pIni pFin dameSeg *troca* erroria errores error0 ) (defun erroria () (defun errores (mens) (setq *error* error0) (command-s "._undo" "_1") (prin1) ) (setq error0 *error* *error* errores ) ) (defun dameSeg (e p1 p2 / vlae pIni pFin rg) (setq pIni (vlax-curve-getPointatParam (setq vlae (vlax-ename->vla-object e)) (vlax-curve-getStartParam vlae)) pFin (vlax-curve-getPointatParam vlae (vlax-curve-getEndParam vlae)) rg (* (getvar "PICKBOX") (/ (getvar "VIEWSIZE") (cadr (getvar "SCREENSIZE"))) 1.01) ) (if (and (or (equal p1 pIni rg) (equal p1 pFin rg) ) (or (equal p2 pIni rg) (equal p2 pFin rg) ) ) T ) ) (defun grreadea (/ para lr ) (while (not para) (princ "\rPress TAB to switch modifications, Select next object to split or RIGHT CLICK to EXIT...") (setq lr (grread T 4 2)) (cond ((= (car lr) 2) (cond ((= (cadr lr) 9) (setq *troca* (not *troca*)) (entmod (append (if *troca* lent lent1) lstChg)) (entmod (append (if *troca* lent1 lent) lstR)) ) ) ) ((= (car lr) 25) (setq para 0 ep nil) ) ((= (car lr) 3) (if (listp (cadr lr)) (setq ep (nentselp (cadr lr)) ep (if (wcmatch (cdr (assoc 0 (entget (car ep)))) "*LINE,ARC,CIRCLE") ep) para (if ep T) ) ) ) (T (if (/= (car lr) 5) (print lr) )) ) ) para ) (erroria) (setq osmant (getvar "OSMODE") ecoA (getvar "CMDECHO") eumk nil tl "DASHED2" tl (if (tblsearch "LTYPE" tl) tl (progn (vlr-beep-reaction) (alert (princ (strcat "\n*** Linetype " tl " not found. It will be instead CONTINUOUS"))) "CONTINUOUS" ) ) lstChg (list '(8 . "0") ; the default layer (cons 6 tl) ; line type '(48 . 0.25) ; thickness '(62 . 84) ; color ) ) (setvar "CMDECHO" 0) (while (and (not para) (or ep (setq ss (SETVAR "NOMUTT" 1) ss (princ "\nSelect object to trim (RIGH CLICK to EXIT)...") ss (ssget "_+.:E:S" '((0 . "*LINE,POLYLINE,CIRCLE,ARC"))) ) ) ) (SETVAR "NOMUTT" 0) (setq entUlt (entlast)) (princ "\nSelect the object to split...") (setq ent (if ep (car ep) (ssname ss 0)) lstR (list (cons 6 (if (assoc 6 (entget ent)) (cdr (assoc 6 (entget ent))) "BYLAYER")) (cons 48 (if (assoc 48 (entget ent)) (cdr (assoc 48 (entget ent))) 1.0)) (cons 62 (if (assoc 62 (entget ent)) (cdr (assoc 62 (entget ent))) 256)) ) ) (setq pt1 (getpoint "\nSelect the first break point: ") ;; Entering the first break point pt2 (getpoint "\nSelect the second break point: ") ;; Entering the second break point ep nil ) (vla-startUndomark (vla-get-activeDocument (vlax-get-acad-object))) ;; Checking the object type and performing the split (cond ((wcmatch (setq to (cdr (assoc 0 (entget ent)))) "*LINE") ;; break polyline (setq pt1 (vlax-curve-getClosestPointTo (vlax-ename->vla-object ent) pt1) pt2 (vlax-curve-getClosestPointTo (vlax-ename->vla-object ent) pt2) ) (command "_.BREAK" ent pt1 pt2) (command "_.LINE" pt1 pt2 "") (entmod (append (ENTGET (ENTLAST)) lstChg)) ) ((= to "CIRCLE") ;; break the circle (setvar "OSMODE" 0) (entmake (entget ent)) (command "_.BREAK" ent pt1 pt2) (command "_.BREAK" (entlast) pt2 pt1) (setq lent (entget ent)) (entmod (append (setq lent1 (entget (entlast))) lstChg)) (setq para (= 0 (grreadea))) ) ((= to "ARC") ;; break the arc (setvar "OSMODE" 0) (setq ;ent1 (entmake (entget ent)) pIni (vlax-curve-getPointatParam (setq vlae (vlax-ename->vla-object ent)) (vlax-curve-getStartParam vlae)) pFin (vlax-curve-getPointatParam vlae (vlax-curve-getEndParam vlae)) pt1 (polar (setq c (cdr (assoc 10 (setq lent (entget ent))))) (angle c pt1) (setq r (cdr (assoc 40 lent)))) pt2 (polar c (angle c pt2) r) ) (command "_.BREAK" ent pt1 pt1) (if (equal (car (nentselp pt2)) (setq ent1 (entlast))); SI P2 EST脕 SOBRE LA NUEVA ENTIDAD CREADA (command "_.BREAK" ent1 pt2 pt2) (command "_.BREAK" ent pt2 pt2) ) (entmod (append (entget (if (dameSeg (setq ent2 (entlast)) pt1 pt2) ent2 ent1)) lstChg)) ) (T (prompt "An object of an unsupported type.") ) ) (vla-EndUndomark (vla-get-activeDocument (vlax-get-acad-object))) (setq eumk T) (setvar "OSMODE" OSMANT) ) (if ecoA (setvar "CMDECHO" ecoA)) (if (not entUlt) (princ "\nObjects are not selected.")) (princ) )
  24. RE: PNO lisp: Can additional attributes be added to factor the outcome of Incremental numbers? When I review the PNO lisp I keep wondering, can the results of assigned incremental number in "Port_Number" attribute be secondarily ordered by a 2nd attribute "Sort_Order2" value after the 1st "Sort-Order" value? AND possibly by 3rd priority sort of 3rd attribute's alphabetic value in a 3rd attribute "Sort_Order3"? These option, if possible, would allow more control of the assigned incremental numbers. Attached is blocks as example. PNO TEST-LSP FOR NUMBING2.dwg
  25. There are some LISPs/programs out there. AutoCAD Architecture FREE toolset has the AECLINEWORKSHRINKWRAP command. Or... Polyline Outline (Advanced) | Lee Mac Programming. Maybe this... TotalBoundary • Outline creation tool - Programs and Scripts - AutoCAD Forums Maybe something in this thread...
  26. There are some LISPs/programs out there. AutoCAD Architecture FREE toolset has the AECLINEWORKSHRINKWRAP command. Or... Polyline Outline (Advanced) | Lee Mac Programming. Maybe this... TotalBoundary • Outline creation tool - Programs and Scripts - AutoCAD Forums Maybe something in this thread...
  27. Steven P

    Autocad join command

    Slight different way of looking at this - back to OPs original problem of how to select the entities - instead of insert and explode, load the block into the drawing and grab the entities it contains from there. The block doesn't need to be inserted, that can come shortly. This will insert the exploded block (for most simple entities, not tested fully) The selection set MyAllSS contains all the inserted entities, so I think (command "join" .... ) will join everything together You'll have to adjust the BlockName list. (defun c:SSBlockEntities ( / BlockName acount MyEnts MyAllSS MySS MyEnt NewEnt) ;;Sub routines ;;https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-select-all-entities-inside-of-a-block/td-p/10284294 (defun blockcomponents ( blk / ent rtn ) (if (setq ent (tblobjname "block" blk)) (while (setq ent (entnext ent)) (setq rtn (cons ent rtn)) ) ) (reverse rtn) ) ;; End subroutines (setq BlockName '( "CircuitBreaker" "CT")) ;; Block Names to assess (setq MyAllSS (SSAdd)) ;; Blank Selection set - all entities, all blocks (foreach n BlockName (setq MySS (SSAdd)) ;; Blank Selection set (setq acount 0) ;; A counter (setq MyEnts (blockcomponents n)) ;; Entity list for block (while (< acount (length MyEnts)) ;; Loop this block (setq MyEnt (entget (nth acount MyEnts))) ;; nth entity description (setq NewEnt (entmakex MyEnt)) ;; Make a new entity (ssadd NewEnt MySS) ;; Add entity to selection set (ssadd NewEnt MyAllSS) ;; Add entity to selection set - all entities, all blocks (setq acount (+ acount 1)) ;; Increase Loop ) ; end while ;; Or do command 'Move' and 'rotate' on MySS selection set here: (command "move" MySS "" '(0 0 0) pause "") (command "rotate" MySS "" (getvar 'lastpoint) pause) ) ; foreach n (princ) ; exit quietly )
  1. Load more activity
×
×
  • Create New...