Message 1 of 24
Not applicable
11-05-2020
07:26 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I would like to put all blocks collected into groups or arrays or lists... lisp is weird... by and attribute value... pole_id then I need to draw a polyline according to the "drop_order". Please help me.
Here is the code I have so far which draws by "drop_order" all the blocks selected but I need it to sort them by the "pole_id" first then draw polylines for each group separately.
This code is taken from snippets from a Lee Mac answer a long time back.
(defun C:PP-CARDBIP ; = CONNECT BLOCKS BY INSERTION POINTS - ORIGINALLY LBS
(/ *error* ent fmt idx ins ocs par sel spc txt typ uxa ss blk att blkinslist)
;(prompt "\nTo Link Blocks with Lines in Attribute Sequence,")(if (setq ss (ssget '((0 . "INSERT") (66 . 1) (2 . "ACMAP_ANN_TEMPLATE_PERMIT-FEATURES") ))); could omit (66 . 1)*
(prompt "\nTo Link Blocks with Lines in Attribute Sequence,")
(if (setq ss (ssget '((0 . "INSERT") (66 . 1) (2 . "ar_drop_point") ))); could omit (66 . 1)*
(progn ; then
(repeat (setq n (sslength ss)); step through selection set
(setq
blk (ssname ss (setq n (1- n))); Block entity name
att (entnext blk); Attribute entity name
blkinslist ; list of integer equivalents of Attribute values paired with insertion points
(cons
(list
;(atoi
;(princ(LM:getattributevalue att "COMMENT_1"))
(princ(LM:getattributevalue att "drop_order"))
;(cdr
; (assoc 1 (entget att)
; ); assoc
;); cdr
;); atoi - turns string into integer
; gets the insertion point here
(trans
(cdr
(assoc 10
(entget blk)
); assoc
); cdr
0 1
); trans
; finish getting the insertion points
); list
blkinslist
); cons
); setq
); repeat
(setq blkinslist ; replace former content
(mapcar 'cadr ; keep only insertion points after:
(vl-sort blkinslist '(lambda (a b) (< (car a) (car b)))); sorting in Attribute-value order
); mapcar
); setq
(command "-COLOR" 6)
(command "")
(command "_.pline"); consider Polyline instead, possibly with specified width
(apply 'command blkinslist); feed points to Line command
(command ""); end Line command
;(LM:inputfootage); call text input - might work on this later but have seperated the two
(princ)
); progn
(prompt "\nNo PERMIT-FEATURE Blocks selected."); else
); if ACMAP_ANN_TEMPLATE_PERMIT-FEATURES
); defun
Solved! Go to Solution.