bijoyvm Posted September 1, 2011 Posted September 1, 2011 hi, attached lisp routine is to create an attribute block, please help me to disable attribute lock position in this help I didn't know the variable for that. and is it possible to add background mask in attiribute? thanks regards bijoy.v.m Block .lsp Quote
ketxu Posted September 1, 2011 Posted September 1, 2011 It's a property.So You can use sth like : (vla-put-lockposition (vlax-ename->vla-object (car(entsel))) 0) or look into dxf 280 ^^ Quote
Lee Mac Posted September 1, 2011 Posted September 1, 2011 I wouldn't recommend using the "-attdef" command, since the prompts can change depending upon the TextStyle being used. But as a quick fix to remove position Locking, change: (Command "-attdef" "" "NO" "Number" "00" "S" "Gen-Text" "J" "ML" (list 3.00 0.00 0.00) "0") to: (command "_.-attdef" "_L" "" "NO" "Number" "00" "S" "Gen-Text" "J" "ML" (list 3.00 0.00 0.00) "0") I would recommend using entmake to create the attribute definition however, since this provides absolute control over the attribute properties, not reliant on prompts. Quote
bijoyvm Posted September 1, 2011 Author Posted September 1, 2011 (edited) thanks ketxu and mac.... entmake command is not working can you please check th ebelow code.. (entmake (list (cons 0 "ATTDEF") (cons 7 "Gen-Text") (cons 8 "0") (cons 1 "00") (cons 2 "NO") (cons 2 "Number") (cons 10 (list 3.0 -1.25 0.0)) (cons 11 (list 3.0 0.0 0.0)) (cons 41 2.5) (cons 41 1.0) (cons 50 0.0) (cons 51 0.0) (cons 72 0) (cons 73 0) (cons 280 1))) regards bijoy.v.m Edited September 1, 2011 by bijoyvm Quote
SLW210 Posted September 1, 2011 Posted September 1, 2011 Please read CODE POSTING GUIDLINES bijoyvm and edit your post. Quote
Lee Mac Posted September 1, 2011 Posted September 1, 2011 entmake command is not working can you please check th ebelow code.. (entmake (list (cons 0 "ATTDEF") (cons 7 "Gen-Text") (cons 8 "0") (cons 1 "00") (cons 2 "NO") (cons 2 "Number") (cons 10 (list 3.0 -1.25 0.0)) (cons 11 (list 3.0 0.0 0.0)) (cons 41 2.5) (cons 41 1.0) (cons 50 0.0) (cons 51 0.0) (cons 72 0) (cons 73 0) (cons 280 1))) You will need to entmake the whole block definition if you are to proceed in this way, for example: (defun c:crb ( ) (if (not (tblsearch "BLOCK" "CRBLK")) (progn (if (not (tblsearch "STYLE" "Gen-Text")) (entmake (list (cons 0 "STYLE") (cons 100 "AcDbSymbolTableRecord") (cons 100 "AcDbTextStyleTableRecord") (cons 2 "Gen-Text") (cons 70 0) (cons 40 2.5) (cons 3 "Arial.ttf") ) ) ) (entmake (list (cons 0 "BLOCK") (cons 8 "0") (cons 370 0) (cons 2 "CRBLK") (cons 70 2) (list 10 0.0 0.0 0.0) ) ) (entmake (list (cons 0 "CIRCLE") (cons 8 "0") (cons 370 0) (list 10 0.0 0.0 0.0) (cons 40 1.25) ) ) (entmake (list (cons 0 "ATTDEF") (cons 8 "0") (cons 370 0) (cons 7 "Gen-Text") (list 10 3.0 0.0 0.0) (list 11 3.0 0.0 0.0) (cons 40 2.5) (cons 1 "00") (cons 3 "Number") (cons 2 "NO") (cons 70 0) (cons 72 0) (cons 74 2) ) ) (entmake (list (cons 0 "ENDBLK") (cons 8 "0") ) ) ) ) (princ) ) Quote
bijoyvm Posted September 4, 2011 Author Posted September 4, 2011 hi lee.. I have one doubt, when I was trying to insert this block created by CRB lisp it will appear very small. I check properties of that block it showing "Unitless". and I open that block in block editor it showing correct text size "2.5". is it possible to solve this problem? thanks and regards bijoy.v.m Quote
pBe Posted September 4, 2011 Posted September 4, 2011 I always wondered about that myself bijoyvm. what i usually do is include this code after creation of the block ......[color=silver](entmake[/color] [color=silver] (list[/color] [color=silver] (cons 0 "ENDBLK")[/color] [color=silver] (cons 8 "0")[/color] [color=silver] )[/color] [color=silver] )[/color] [color=blue] (vla-put-units[/color] [color=blue](vla-item[/color] [color=blue] (vla-get-blocks[/color] [color=blue] (vla-get-activedocument (vlax-get-acad-object)))[/color] [color=blue] "CRBLK")[/color] [color=blue] 1) [/color] [color=silver])[/color] [color=silver])[/color] [color=silver](princ)[/color] [color=plum])[/color] Where: 1 Inches 2 Feet 4 Millimeters 5 Centimeters 6 Meters But then again with the introduction of Annotative blocks it was never a problem for us anymore Quote
Tharwat Posted September 4, 2011 Posted September 4, 2011 Or maybe to adjust the System variable (insunits) to one of the following as required. Note: The INSUNITS setting is ignored when inserting annotative blocks into a drawing. 0 Unspecified (No units) 1 Inches 2 Feet 3 Miles 4 Millimeters 5 Centimeters 6 Meters 7 Kilometers 8 Microinches 9 Mils 10 Yards 11 Angstroms 12 Nanometers 13 Microns 14 Decimeters 15 Decameters 16 Hectometers 17 Gigameters 18 Astronomical Units 19 Light Years 20 Parsecs Quote
pBe Posted September 4, 2011 Posted September 4, 2011 Yes, but i'm talking about Block Creation, a block created with UNITLESS does matter. have you tried inserting unitless blocks compared to blocks with specific units? Quote
Tharwat Posted September 4, 2011 Posted September 4, 2011 IMO. whatever your block units would be created with , the system variable insunits would change the insertion according to the given value . (even unitless ). Quote
pBe Posted September 4, 2011 Posted September 4, 2011 I suggest you try it Thrwat. Just for the heck of it. There is a BIG difference. Ever wonder why did the OP's insetion came in very small? regrardless of units? Quote
Tharwat Posted September 4, 2011 Posted September 4, 2011 I suggest you try it Thrwat. Just for the heck of it. There is a BIG difference. Ever wonder why did the OP's insetion came in very small? regrardless of units? I will do it right now . One question : What are the steps that you are following please ? Quote
pBe Posted September 4, 2011 Posted September 4, 2011 No process really, just doing it right seriously.. try Lee's CRB code to create the CRBLK block, after that run the code again with the snippet i posted but name the block CRBL Insert them both. you will see the difference.. try at least 5 UNITS value inches.meter,feet Quote
Tharwat Posted September 4, 2011 Posted September 4, 2011 That killed the attdef from the block No more attdef with the block , it is only a circle with a text . Quote
pBe Posted September 4, 2011 Posted September 4, 2011 No it wont "kill" the atttribute. cmon now. Remember "doing it right" Quote
Tharwat Posted September 4, 2011 Posted September 4, 2011 The last block created with your snippet codes , would be considered for the insertion . So where is the fruit of the process now ? . Quote
pBe Posted September 4, 2011 Posted September 4, 2011 The last block created with your snippet codes , would be considered for the insertion . So where is the fruit of the process now ? . ... oh well Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.