Message 1 of 21
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
My field crew sometimes record more than one shot on an ADA ramp. I only need one ADA block per ramp.
code that selects bn ; bn block name
and pt ; pt point to insert block
etc.
.
.
.
(setq bn "ADA" ; stub in bn
pt '(100 200 0) ; stub in pt
layer "Sidewalk" ; stub in layer
scale 40.0 ; stub in scale
)
(if
(or
(and
(= bn "ADA")
(and
(not
(command-s
"zoom"
(polar pt
2.3561945
20.0
)
(polar pt
5.4977871
20.0
)
)
) ; (not negates nil returned after successful zoom
(not
(ssget "_C"
(polar pt
2.3561945
10.0
)
(polar pt
5.4977871
10.0
)
'((0 . "INSERT")
(2 . "ADA")
)
)
) ; no ADA exists in aprox 10'
) ; (and zoom test
) ; (and (= bn "ADA")
(/= bn "ADA")
) ; (or
(entmake
(list (cons 0 "INSERT")
; place block on pt
(cons 100 "AcDbEntity")
; 100 Entity Code
(cons 8 layer) ; The Layer
(cons 100 "AcDbBlockReference")
; 100 Entity Block
(cons 2 bn) ; block name
(cons 10 pt) ; insertion point
(cons 41 (/ sc 40)) ; x scale
(cons 42 (/ sc 40)) ; y scale
(cons 43 (/ sc 40)) ; z scale
(cons 50 0) ; insertion angle
) ; list
) ; entmake (list '(0 . "INSERT")
) ; (if bn
This code works but there has to be better code. Something that does the ssget trick without running all over giving focus to ssget so it can be visual. Or some way to turn ssget's visual requirement off. As it is this routine is called for each block and the drafter is left staring at the last ADA block entered (other blocks don't change the focus.)
Please. Thank you for your attention.
Solved! Go to Solution.