Jump to content

How to disable attribute "LOCK POSITION" while creating Lisp


Recommended Posts

Posted

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

  • Replies 29
  • Created
  • Last Reply

Top Posters In This Topic

  • pBe

    9

  • bijoyvm

    7

  • Tharwat

    6

  • Lee Mac

    5

Top Posters In This Topic

Posted

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 ^^

Posted

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.

Posted (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 by bijoyvm
Posted
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)
)

Posted

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

Posted

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

Posted

Or maybe to adjust the System variable (insunits) to one of the following as required. :roll:

 

 

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

Posted

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?

Posted

IMO. whatever your block units would be created with , the system variable insunits would change the insertion according to the given value . (even unitless ).

Posted

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?

Posted
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 ?

Posted

No process really, just doing it right :lol:

 

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

Posted

That killed the attdef from the block :shock:

 

No more attdef with the block , it is only a circle with a text . :lol:

Posted

No it wont "kill" the atttribute. :lol: cmon now.

 

Remember "doing it right"

Posted

The last block created with your snippet codes , would be considered for the insertion .

 

So where is the fruit of the process now ? . :danger: :lol:

Posted
The last block created with your snippet codes , would be considered for the insertion .

 

So where is the fruit of the process now ? . :danger: :lol:

 

:facepalm: ... oh well

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...