Jump to content
woodman78

Pause a lisp to interact with a dynamic block and then resume the lisp

Recommended Posts

woodman78

Hi,

I have a lisp to create tactile paving either by selecting a closed polyline or by drawing a polyline. I want to insert a dynamic block to form construction lines for the tactile paving in the draw option but I want to be able to adjust the block to suit the local conditions and then resume the command and draw along the block outline. Can anyone guide me with this?

 

(defun C:Proposed_Tactile_Red (/ ang coords elist midp offsetted offsetted1 ofpt p1 p2 p3 pline side SUCE SUOM SUSM SUAB SUAD SUCL SUCR)
(setq SUCE (getvar "cmdecho"))
 (setq SUOM (getvar "orthomode"))
 (setq SUSM (getvar "osmode"))
 (setq SUAB (getvar "angbase"))
 (setq SUAD (getvar "angdir"))
 (setq SUCL (getvar "clayer"))
 (setq SUCR (getvar "cecolor"))


(setq vl1 (list
	(cons 0 "LAYER")		;Name of entity
	(cons 100 "AcDbSymbolTableRecord")					;Open Records
	(cons 100 "AcDbLayerTableRecord")					;Locate Layer Table
	(cons 2 "CCC_LAYOUT_Proposed_Tactile_Paving_Red_Solid_Hatch")			;Name of Layer
	(cons 6 "Continuous")						;Linetype
	(cons 62 253)							;colour = light grey
	(cons 70 0)							;state
	(cons 290 1)							;1=plot, 0=Don't plot
		)							;End of entity list
	)
	(entmake vl1)

(setq vl1 (list
	(cons 0 "LAYER")		;Name of entity
	(cons 100 "AcDbSymbolTableRecord")					;Open Records
	(cons 100 "AcDbLayerTableRecord")					;Locate Layer Table
	(cons 2 "CCC_LAYOUT_Proposed_Tactile_Paving_Red_Hex_Hatch")			;Name of Layer
	(cons 6 "Continuous")						;Linetype
	(cons 62 7)							;colour = light grey
	(cons 70 0)							;state
	(cons 290 1)							;1=plot, 0=Don't plot
		)							;End of entity list
	)
	(entmake vl1)
(setq vl1 (list
	(cons 0 "LAYER")		;Name of entity
	(cons 100 "AcDbSymbolTableRecord")					;Open Records
	(cons 100 "AcDbLayerTableRecord")					;Locate Layer Table
	(cons 2 "CCC_LAYOUT_Proposed_Tactile_Paving_Red_Outline")			;Name of Layer
	(cons 6 "Continuous")						;Linetype
	(cons 62 7)							;colour = light grey
	(cons 70 0)							;state
	(cons 290 1)							;1=plot, 0=Don't plot
		)							;End of entity list
	)
	(entmake vl1)
(setq vl1 (list
	(cons 0 "LAYER")		;Name of entity
	(cons 100 "AcDbSymbolTableRecord")					;Open Records
	(cons 100 "AcDbLayerTableRecord")					;Locate Layer Table
	(cons 2 "CCC_LAYOUT_Proposed_Tactile_Paving_Red_Construction")			;Name of Layer
	(cons 6 "Continuous")						;Linetype
	(cons 62 7)							;colour = light grey
	(cons 70 0)							;state
	(cons 290 1)							;1=plot, 0=Don't plot
		)							;End of entity list
	)
	(entmake vl1)

(command "_.-layer" "_C" "_T" "255,204,204" "CCC_LAYOUT_Proposed_Tactile_Paving_Red_Solid_Hatch" "")
(command "_.-layer" "_LW" "0" "CCC_LAYOUT_Proposed_Tactile_Paving_Red_Outline" "")
(command "_.-layer" "_LW" "0" "CCC_LAYOUT_Proposed_Tactile_Paving_Red_Hex_Hatch" "")
(setvar "clayer" "CCC_LAYOUT_Proposed_Tactile_Paving_Red_Solid_Hatch")  
(setvar "cecolor" "1")

(initget "D S")
(setq option (getkword "\nChoose to Draw a boundary or Select a boundary: [D/S]: "))
(cond     ((= option "D")(Proposed_Tactile_Red_draw))
((= option "S")(Proposed_Tactile_Red_select))
)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun Proposed_Tactile_Red_select ()
(setq pline(entsel "\nSelect a closed polyline boundary: "))
(Proposed_Tactile_Red_resume)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[color="red"](defun Proposed_Tactile_Red_draw ()
(princ "\nPlace the construction block in the correct location and adjust to suit the local conditions. ")
(setvar "clayer" "CCC_LAYOUT_Proposed_Tactile_Paving_Red_Construction")  
(command "_.insert" "Red_Tactile_Construction" "_scale" "1" pause "")
(princ "\nDraw an outline for red tactile paving: ")[/color]
(setvar "cecolor" "1") 
(setvar "plinegen" 1)
(command "._pline")
(while (= 1 (logand 1 (getvar "cmdactive")))
(command pause))
(setq pline (entlast)
elist (entget pline)
)
(setvar "cecolor" "Bylayer")  
(command "_.draworder" pline "" "_F");<--set pline's draw order to front  
(command "_change" pline ""  "p" "Layer" "CCC_LAYOUT_Proposed_Tactile_Paving_Red_Outline" "color" "Bylayer" "")
(Proposed_Tactile_Red_resume)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun Proposed_Tactile_Red_resume ()
;(command "._pedit" pline "_W" 0.1 "")
(setq coords (vl-remove-if (function not)
(mapcar (function (lambda (x)
(if (= 10 (car x))(cdr x))))
elist))
)
(setq p2 (car coords)
midp (mapcar (function (lambda( a b)(/ (+ a b) 2)))
p1 p2)
)
 (setvar "cecolor" "Bylayer") 
 (setvar "hpname" "Solid")
 ;(setvar "hpang" 45)
 ;(setvar "hpscale" 0.2)
 (command "-hatch" "S" pline "" "")

(setvar "clayer" "CCC_LAYOUT_Proposed_Tactile_Paving_Red_Hex_Hatch") 
 (setvar "hpname" "hex")
 ;(setvar "hpang" 45)
 (setvar "hpscale" 0.035)
 (command "-hatch" "S" pline "" "")

(command "_change" pline ""  "p" "Layer" "CCC_LAYOUT_Proposed_Tactile_Paving_Red_Outline" "color" "Bylayer" "")
;(command "_.-layer" "_OFF" "CCC_LAYOUT_Proposed_Tactile_Paving_Red_Outline" "")

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 (setvar "cmdecho" SUCE)
 (setvar "orthomode" SUOM)
 (setvar "osmode" SUSM)
 (setvar "angbase" SUAB)
 (setvar "angdir" SUAD)
 (setvar "clayer" SUCL)
 (setvar "cecolor" SUCR)
(princ) 
)

Red_Tactile_Construction.dwg

Share this post


Link to post
Share on other sites
BIGAL

If you draw the outline first and save the object etc can you then insert your Red_tac.. and use those properties to set the block. Not sure how you eidt it ?

 

I dont use dynaic blocks enough to comment maybe do this as a little lisp to test.

Share this post


Link to post
Share on other sites
woodman78

Thanks Bigal but not quite what I was looking for.

Share this post


Link to post
Share on other sites
woodman78

I made some progress on this in that now the block is inserted and the command pauses and then when I click again it continues on as it should. The only problem is that when it pauses it doesn't allow interaction with the dynamic block.

 

Can anyone help?

 

 

(defun Proposed_Tactile_Red_draw ()
(princ "\nPlace the construction block in the correct location and adjust to suit the local conditions. ")
(setvar "clayer" "CCC_LAYOUT_Proposed_Tactile_Paving_Red_Construction")  
(command ".-Insert" "Red_Tactile_Construction" pause "1" "1" "0" pause pause)
;(command "_.insert" "Red_Tactile_Construction" "_scale" "1" pause "")
(princ "\nDraw an outline for red tactile paving: ")
(setvar "cecolor" "1") 
(setvar "plinegen" 1)
(command "._pline")
(while (= 1 (logand 1 (getvar "cmdactive")))
(command pause))
(setq pline (entlast)
elist (entget pline)
)
(setvar "cecolor" "Bylayer")  
(command "_.draworder" pline "" "_F");<--set pline's draw order to front  
(command "_change" pline ""  "p" "Layer" "CCC_LAYOUT_Proposed_Tactile_Paving_Red_Outline" "color" "Bylayer" "")
(Proposed_Tactile_Red_resume)
)

Share this post


Link to post
Share on other sites
woodman78

Is there some way to pause the lisp to interact with the dynamic block and then resume on right click?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×