Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Lisp for insert Block depending of another attribute

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
C.Utzinger
1362 Views, 3 Replies

Lisp for insert Block depending of another attribute

HI

 

I'm looking for a code for inserting a block and make the Attribute depend of a existing Attribute (see the attached dwg).

 

I have several problems:

 

 1 - Why is there a grey shadow?

 2 - How can a eliminate the not needed text " \W0.7000; ".

 3 - With the code I also want to automatically change the layer of the existing block to an not printed layer I have.

 

 

Thanks for help

 

3 REPLIES 3
Message 2 of 4
paullimapa
in reply to: C.Utzinger

Grey Shadow is AutoCAD's way of telling you that this object is a FIELD.  To turn this feature off, set FIELDDISPLAY to 0

Perhaps others can jump in on solving FIELDS displaying the \W0.7000 code when Attributes are Multiline?

 

Area Object Link | Attribute Modifier | Dwg Setup | Feet-Inch Calculator
Layer Apps | List on Steroids | VP Zoom Scales | Exchange App Store


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 3 of 4
Ranjit_Singh2
in reply to: paullimapa


@paullimapa wrote:

............FIELDS displaying the \W0.7000 code when Attributes are Multiline?

 

Area Object Link | Attribute Modifier | Dwg Setup | Feet-Inch Calculator
Layer Apps | List on Steroids | VP Zoom Scales | Exchange App Store


That is coming from OPs text style that was used to define the blocks. It has a width factor applied to it. OP needs to edit the existing block to use a different text style.

Message 4 of 4
C.Utzinger
in reply to: C.Utzinger

I found this code, this one makes nearly that what i'm looking for...

 

Any Idea?

 

;;; By Jimmy Bergmark

(defun Get-ObjectIDx64 (obj / util)
  (setq util (vla-get-Utility (vla-get-activedocument (vlax-get-acad-object))))
  (if (= (type obj) 'ENAME)(setq obj (vlax-ename->vla-object obj)))
  (if (= (type obj) 'VLA-OBJECT)
    (if (> (vl-string-search "x64" (getvar "platform")) 0)
      (vlax-invoke-method util "GetObjectIdString" obj :vlax-False)
      (rtos (vla-get-objectid obj) 2 0)
    )
  )
)

(defun c:AT (/ entObject entObjectID InsertionPoint ad)
  (vl-load-com)
  (setq entObject (vlax-ename->vla-object(car (entsel)))
        entObjectID (Get-ObjectIDx64 entObject)
        InsertionPoint (vlax-3D-Point (getpoint "Einfügepunkt Text angeben: "))
        ad (vla-get-ActiveDocument (vlax-get-acad-object))
  )
  (vla-addMText (if (= 1 (vla-get-activespace ad))
    (vla-get-modelspace ad)
    (if (= (vla-get-mspace ad) :vlax-true)
      (vla-get-modelspace ad)
      (vla-get-paperspace ad)
    )
  )
  InsertionPoint 0.0 (strcat
  "%<\\AcObjProp Object(%<\\_ObjId "
  entObjectID
;;;">%).Area \\f \"%pr2%lu2%ct4%qf1 SQ. FT.\">%"
">%).Area \\f \"" "%pr2%lu6%qf1%ps[,m²]%ct8[1e-4]""\">%"
  ))
)

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report