<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Limit Field Options and Format in AutoCAD Forum</title>
    <link>https://forums.autodesk.com/t5/autocad-forum/limit-field-options-and-format/m-p/6629088#M256033</link>
    <description>&lt;P&gt;I'm trying to create a multileader that displays a polyline length in a field (in order to prevent the user of typing it). I created the multiline and placed the field but always when I double click the field (to change the object reference), it displays again the Field Options Menu, and when I select a new object the field loses the previous Property selected and the Additional format configuration (Prefix and Sufix).&lt;/P&gt;&lt;P&gt;+ When I try to use the same multileader in a different drawing it loses all the fields presets.&amp;nbsp;&lt;BR /&gt;Is it possible to have a field/lisp or block that automaticaly takes only the polyline length even when you change the reference/drawing without losing its presets?&lt;/P&gt;</description>
    <pubDate>Tue, 18 Oct 2016 13:48:45 GMT</pubDate>
    <dc:creator>rafaelricardorj</dc:creator>
    <dc:date>2016-10-18T13:48:45Z</dc:date>
    <item>
      <title>Limit Field Options and Format</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/limit-field-options-and-format/m-p/6629088#M256033</link>
      <description>&lt;P&gt;I'm trying to create a multileader that displays a polyline length in a field (in order to prevent the user of typing it). I created the multiline and placed the field but always when I double click the field (to change the object reference), it displays again the Field Options Menu, and when I select a new object the field loses the previous Property selected and the Additional format configuration (Prefix and Sufix).&lt;/P&gt;&lt;P&gt;+ When I try to use the same multileader in a different drawing it loses all the fields presets.&amp;nbsp;&lt;BR /&gt;Is it possible to have a field/lisp or block that automaticaly takes only the polyline length even when you change the reference/drawing without losing its presets?&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2016 13:48:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/limit-field-options-and-format/m-p/6629088#M256033</guid>
      <dc:creator>rafaelricardorj</dc:creator>
      <dc:date>2016-10-18T13:48:45Z</dc:date>
    </item>
    <item>
      <title>Re: Limit Field Options and Format</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/limit-field-options-and-format/m-p/6629202#M256034</link>
      <description>We have something similar, and we use autolisp code to populate the field data. Takes the options away from the user so that the object reference is correct.</description>
      <pubDate>Tue, 18 Oct 2016 14:28:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/limit-field-options-and-format/m-p/6629202#M256034</guid>
      <dc:creator>rkmcswain</dc:creator>
      <dc:date>2016-10-18T14:28:49Z</dc:date>
    </item>
    <item>
      <title>Re: Limit Field Options and Format</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/limit-field-options-and-format/m-p/6629224#M256035</link>
      <description>&lt;P&gt;it's exactly what I need, could you help me with that?&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2016 14:32:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/limit-field-options-and-format/m-p/6629224#M256035</guid>
      <dc:creator>rafaelricardorj</dc:creator>
      <dc:date>2016-10-18T14:32:58Z</dc:date>
    </item>
    <item>
      <title>Re: Limit Field Options and Format</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/limit-field-options-and-format/m-p/6629264#M256036</link>
      <description>Take a look at this:&lt;BR /&gt;&lt;A href="http://www.lee-mac.com/quickfield.html" target="_blank"&gt;http://www.lee-mac.com/quickfield.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 18 Oct 2016 14:44:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/limit-field-options-and-format/m-p/6629264#M256036</guid>
      <dc:creator>rkmcswain</dc:creator>
      <dc:date>2016-10-18T14:44:35Z</dc:date>
    </item>
    <item>
      <title>Re: Limit Field Options and Format</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/limit-field-options-and-format/m-p/6629516#M256037</link>
      <description>&lt;P&gt;The code is great,&amp;nbsp;I already changed the prefix and sufix of the field but&amp;nbsp;I don't know how to change the properties (layer, color, TextStyle) of the resultant field inside this code and how to do it all inside a multileader or block, could you help me?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;(defun c:test2 ( ) (LM:QuickField "Length" "%lu2%pr2%ps[C= ,m]" 3))
(defun LM:quickfield ( prop format mode / ent ins obj str )  
    (if (setq str (LM:quickfield:constructfieldstring prop format))
        (cond
            (   (= 1 mode)
                (if (setq ent (LM:quickfield:selectifhasprop "Textstring" nentsel))
                    (progn
                        (setq obj (vlax-ename-&amp;gt;vla-object ent))
                        (vla-put-textstring obj "") ;; To clear any existing field
                        (vla-put-textstring obj str)
                        (if (= "ATTRIB" (cdr (assoc 0 (entget ent))))
                            (vl-cmdf "_.updatefield" ent "")
                        )
                    )
                )
            )
            (   (= 2 mode)
                (if (setq ins (getpoint "\nSpecify point for text: "))
                    (vla-addtext
                        (vlax-get-property (LM:quickfield:acdoc)
                            (if (= 1 (getvar 'cvport))
                                'paperspace
                                'modelspace
                            )
                        )
                        str (vlax-3D-point (trans ins 1 0)) (getvar 'textsize)
                    )
                )
            )
            (   (= 3 mode)
                (if (setq ins (getpoint "\nSpecify point for mtext: "))
                    (vla-addmtext
                        (vlax-get-property (LM:quickfield:acdoc)
                            (if (= 1 (getvar 'cvport))
                                'paperspace
                                'modelspace
                            )
                        )
                        (vlax-3D-point (trans ins 1 0)) 0.0 str
                    )
                )
            )
        )
    )
    (princ)
)

(defun LM:quickfield:selectifhasprop ( prop func / ent )
    (while
        (progn
            (setvar 'errno 0)
            (setq ent (car (func (strcat "\nSelect object with " prop " property: "))))
            (cond
                (   (= 7 (getvar 'errno))
                    (princ "\nMissed, try again.")
                )
                (   (null ent)
                    nil
                )
                (   (not (vlax-property-available-p (vlax-ename-&amp;gt;vla-object ent) prop))
                    (princ (strcat "\nSelected object does not have " prop " property."))
                )
            )
        )
    )
    ent
)

(defun LM:quickfield:acdoc nil
    (eval (list 'defun 'LM:quickfield:acdoc 'nil (vla-get-activedocument (vlax-get-acad-object))))
    (LM:quickfield:acdoc)
)

(   (lambda nil (vl-load-com)
        (eval
            (list 'defun 'LM:quickfield:constructfieldstring '( prop format / ent )
                (list 'if '(setq ent (LM:quickfield:selectifhasprop prop entsel))
                    (list 'strcat "%&amp;lt;\\AcObjProp Object(%&amp;lt;\\_ObjId "
                        (if (vlax-method-applicable-p    (vla-get-utility (LM:quickfield:acdoc)) 'getobjectidstring)
                            (list 'vla-getobjectidstring (vla-get-utility (LM:quickfield:acdoc)) '(vlax-ename-&amp;gt;vla-object ent) ':vlax-false)
                           '(itoa (vla-get-objectid (vlax-ename-&amp;gt;vla-object ent)))
                        )
                        "&amp;gt;%)." 'prop '(if (/= "" format) (strcat " \\f \"" format "\"&amp;gt;%") "&amp;gt;%")
                    )
                )
            )
        )
    )
)
(princ)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2016 16:06:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/limit-field-options-and-format/m-p/6629516#M256037</guid>
      <dc:creator>rafaelricardorj</dc:creator>
      <dc:date>2016-10-18T16:06:51Z</dc:date>
    </item>
  </channel>
</rss>

