<?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 Re: LISP for creating field off a selected object, grabbing specific attribute in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-for-creating-field-off-a-selected-object-grabbing-specific/m-p/12752006#M14481</link>
    <description>&lt;P&gt;I am confused when using fields need two objects the first is the relative object eg an Attribute, the second is the destination object say a Mtext or another attribute in another block. Dont need tag name if picking an attribute.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You appear to have only 1 object in the code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Lastly using VL can put a field textstring into a suitable object and will reflect that field.&lt;/P&gt;&lt;P&gt;Selecting an attribute should give this type of string, need to use nentsel to pick attribute rather than block.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;%&amp;lt;\AcObjProp Object(%&amp;lt;\_ObjId 1961879984&amp;gt;%).TextString&amp;gt;%&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 04 May 2024 01:21:51 GMT</pubDate>
    <dc:creator>Sea-Haven</dc:creator>
    <dc:date>2024-05-04T01:21:51Z</dc:date>
    <item>
      <title>LISP for creating field off a selected object, grabbing specific attribute</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-for-creating-field-off-a-selected-object-grabbing-specific/m-p/12750691#M14479</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Looking to create an autocad lisp that allows me to select an object and places a field parameter regarding that specific block's attribute titled CIRCUIT#. Original thought process was to select an object, grab its id, then place field parameter. It should autoselect field category as object, the object type should be the object that I selected, property should be Circuit#, and format should be (none). &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;For reference, here are two examples of the field expression for two objects. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;%&amp;lt;\AcObjProp Object(%&amp;lt;\_ObjId 1770506033232&amp;gt;%).TextString&amp;gt;% &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;%&amp;lt;\AcObjProp Object(%&amp;lt;\_ObjId 1770506022224&amp;gt;%).TextString&amp;gt;% &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have an attempt above!&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(defun c:PlaceField ()
  (setq obj (car (nentselp "\nSelect an object: ")))
  (if obj
    (progn
      (setq entityId (cdr (assoc 5 (entget obj)))) ; Get the handle of the selected object
      (setq fieldText (strcat "%&amp;lt;\\AcObjProp Object(%&amp;lt;\\_ObjId " entityId "&amp;gt;%).Attribute(\"CIRCUIT#\")&amp;gt;%"))
      (command "_.FIELD" "_Object" fieldText "_Type" "Object" "_Object" entityId "_Field")
    )
    (princ "\nNo object selected.")
  )
)



; Examples of proper field expression
;&amp;lt;\AcObjProp Object(%&amp;lt;\_ObjId 1770506033232&amp;gt;%).TextString&amp;gt;%
;%&amp;lt;\AcObjProp Object(%&amp;lt;\_ObjId 1770506022224&amp;gt;%).TextString&amp;gt;%&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2024 12:44:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-for-creating-field-off-a-selected-object-grabbing-specific/m-p/12750691#M14479</guid>
      <dc:creator>MichaelD061</dc:creator>
      <dc:date>2024-05-03T12:44:48Z</dc:date>
    </item>
    <item>
      <title>Re: LISP for creating field off a selected object, grabbing specific attribute</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-for-creating-field-off-a-selected-object-grabbing-specific/m-p/12750980#M14480</link>
      <description>&lt;P&gt;One item you’re missing is the objid. An example of how to get this&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(setq objid (vla-get-ObjectId (vlax-ename-&amp;gt;vla-object enam)))&lt;/LI-CODE&gt;&lt;P&gt;Here’s a &lt;A href="https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/link-between-text-mtext-and-attribute-with-field/m-p/3754079/highlight/true#M308459" target="_blank" rel="noopener"&gt;link&lt;/A&gt; where you can get some ideas on how to put the field expression into an object&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2024 14:36:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-for-creating-field-off-a-selected-object-grabbing-specific/m-p/12750980#M14480</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2024-05-03T14:36:08Z</dc:date>
    </item>
    <item>
      <title>Re: LISP for creating field off a selected object, grabbing specific attribute</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-for-creating-field-off-a-selected-object-grabbing-specific/m-p/12752006#M14481</link>
      <description>&lt;P&gt;I am confused when using fields need two objects the first is the relative object eg an Attribute, the second is the destination object say a Mtext or another attribute in another block. Dont need tag name if picking an attribute.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You appear to have only 1 object in the code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Lastly using VL can put a field textstring into a suitable object and will reflect that field.&lt;/P&gt;&lt;P&gt;Selecting an attribute should give this type of string, need to use nentsel to pick attribute rather than block.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;%&amp;lt;\AcObjProp Object(%&amp;lt;\_ObjId 1961879984&amp;gt;%).TextString&amp;gt;%&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 04 May 2024 01:21:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-for-creating-field-off-a-selected-object-grabbing-specific/m-p/12752006#M14481</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2024-05-04T01:21:51Z</dc:date>
    </item>
  </channel>
</rss>

