Ditutup

AUTO CAD SCRIPT DEFECT

This is VERY Simple for people that know how to write Autocad scripts!!

I have an Auto Cad Script that I am using. The issue what I am having is that when I select the block from the created tool bar. After the initial insertion of the Block. It deactivates my Object Snaps. So when I want to insert another block while still in the command. The OSMODE is no longer Set to (1) its turned off to (0). The way this part of the tool script is set up is so that when I insert a block the command is still running and allows me to insert multiple blocks at multiple location points. So I need the script set so that the OSNAPS stay on....

If you can fix this problem.

Provide to me the line of script so that I may test.

Below is the running script for the tools.

--------------------------------------------------------------------

//

// AutoCAD menu file - O:[url removed, login to view]

//

;;; AutoLISP routines used by the Carastro Electrical Menu.

(princ ;|ACAD_MNL_1|;"nCarastro Electrical menu utilities ")

;;;=== Global AutoLISP functions for [url removed, login to view] ===

(setvar "USERS5" "ACADE")

(defun C:ARROWS () (load (strcat lspdir "ARROWS")) (C:ARROWS))

(defun C:BRACE () (load (strcat lspdir "BRACE")) (C:BRACE))

(defun C:DVT () (load (strcat lspdir "DEV-TRM")) (C:DVT))

(defun C:DCON () (load (strcat lspdir "DEV-TRM")) (C:DCON))

(defun C:LCON () (load (strcat lspdir "LT-TRM")) (C:LCON))

(defun C:LTR () (load (strcat lspdir "LT-TRM")) (C:LTR))

(defun C:IDEN () (load (strcat lspdir "IDEN")) (C:IDEN))

(defun c:D_TEXT (/ ans lyr)

(prompt "n1. Lighting Text 3. Fire Alarm Text")

(prompt "n2. Power Text 4. Misc/Nurse Call Textn")

(if (not txt___opt) (setq txt___opt "1"))

(setq ans (getstr "Text option: " txt___opt "K" "1 2 3 4"))

(setq txt___opt ans)

(cond

((= ans "1") (setq lyr "E-LITE-TEXT"))

((= ans "2") (setq lyr "E-POWR-TEXT"))

((= ans "3") (setq lyr "E-FIRE-TEXT"))

((= ans "4") (setq lyr "E-MISC-TEXT"))

(t nil)

)

(setvar "CLAYER" lyr)

(command "DTEXT")

)

(defun blkscale ()

(/ (getvar "DIMSCALE") 384.0)

)

(defun INSRT (exp blk lyr dscale / curomd blkpnt)

; (cmdoff)

(if (and (= (getvar "users1") "e-1lin") (member (strcase blk)

'("W1E" "W2E" "W3E" "W4E" "W5E" "W6E" "W7E" "W8E"))

)

(progn

(alert "Not allowed for One-Line Diagrams")

(exit)

)

)

(setq curomd (getvar "OSMODE"))

(setvar "osmode" 1)

(initget 9)

(while (setq blkpnt (getpoint "nInsertion point-> "))

(setvar "OSMODE" 1)

(if (member (strcase blk)

'("M1" "M2" "M3" "M4" "M5" "M6" "M7" "M8" "M9"

; "W1E" "W2E" "W3E" "W4E" "W5E" "W6E" "W7E" "W8E" ;;;<--wire counts

"DWGTITLE" "EX" "R")

)

(progn

(if (= (getvar "users1") "e-1lin") ;;;conditions for 1lin symbols

(cond

((member (strcase blk) ;;;wire counts

'("W1E" "W2E" "W3E" "W4E" "W5E" "W6E" "W7E" "W8E"))

(alert "Not allowed for One-Line Diagrams")

(exit)

)

((member (strcase blk) ;;;tri and circ callout

'("M8" "M9"))

(setq lyr "e-misc-note")

)

((member (strcase blk) ;;;hm-run, cap, etc.

'("M1" "M2" "M3" "M4"))

(setq lyr "e-1lin-circ-new")

)

((= (strcase blk) "DWGTITLE")

(setq lyr "e-misc-titl")

)

)

)

(setvar "CLAYER" lyr)

(command ".INSERT" (strcat blkdir blk) blkpnt)

)

(progn ;;;if not 1line symbol

(setvar "CLAYER" lyr)

(command ".INSERT" (strcat esymdir blk) blkpnt)

)

)

(if dscale

(if (or (= dscale "blkscale")(= dscale "BLKSCALE"))

(command (blkscale))

(command dscale)

)

(command (getvar "DIMSCALE"))

)

(command "")

(cond ;;;if callout prompt for #

((member (strcase blk) '("M8" "M9"))

(command "0")

(setq att (num))

(command att)

)

(exp ;;;if block to be exploded

(command pause)

(command ".EXPLODE" (entlast) ".CHANGE" "P" "" "P" "LA" lyr "")

)

(t (command pause))

)

)

(prompt "nDone!")

(setvar "osmode" 1)

; (cmdon)

)

;;;===============================================

Kemahiran: Pengaturcaraan C, Kejuruteraan, Reka Bentuk Grafik, Memasang Skrip, Visual Basic

Lihat lebih lanjut: cad script, auto cad script, autocad script pause, autocad script, autocad script commands, auto script, autocad using explode script, autocad script insert block, autocad scripts, autocad script setvar, autocad script explode, autocad script command, autocad script dtext, autocad insert text using script, cad note, autocad auto script load, autolisp script autocad, dtext autocad script, autocad insert explode, autocad scripts explode, explode script autocad, explode autolisp, clayer autocad, command insert autocad, autocad log file script

Tentang Majikan:
( 1 ulasan ) New Port Richey, United States

ID Projek: #343094