additions for Object Data

additions for Object Data

АлексЮстасу
Advisor Advisor
19,971 Views
118 Replies
Message 1 of 119

additions for Object Data

АлексЮстасу
Advisor
Advisor

As a task manager, I created for myself such additions for Object Data:
 - OD management
    - Copy definitions from file
    - usage stats
    - Rename columns
    - Reorder fields
    - Update definitions
    - Batch update definitions
    - Remove unused
 - Search OD
    - Find entities with no OD
    - Find entities with OD
    - Find entities with duplicate OD
    - Find entities with multiple OD
    - Find entities with no specific OD
    - Find entities with specific OD
    - Find entities with specific OD values
 - Attach/Detach OD
    - Attach/detach
    - Detach all
    - Detach specified
    - Detach duplicate
 - Copy OD
    - Copy OD from reference
    - Copy values from reference
    - Copy properties/OD from reference
    - Copy properties/OD values from reference
 - Set/edit OD values
    - Set values from XYZ
    - Set values from geometric properties
    - Set values from text
    - Create IDs
    - Replace values
    - Values from field in field
 - Modify entities
    - Convert to 2D polylines
    - Convert to 3D polylines
    - Break
 - Import /export
    - Export to mif/mid
    - Batch  export to mif/mid
    - Export to csv
    - Import from csv
 - - OD table

A small example recently posted on the forum: statistics about OD, viewing OD in the table, finding elements without the specified OD, attaching these elements to the required OD.

This list corresponds to the wishes and ideas from this forum: MAP New features - 01 - Improvments on Object Data, http://forums.autodesk.com/t5/autocad-map-3d-general/object-data-how-to-use-the-find-command/td-p/54... etc.


But the list is longer. The necessity of these possibilities is confirmed by daily use - they greatly accelerate, simplify and improve the work.

What other advanced features of working with Object Data may be needed?
For example, add a drawing with the Object Data on the sample of the specified existing object.  Import/export in kml/kmz, geojson. What else?

The resulting plugin could be a prototype for Autodesk add-ons for Object Data.
We could gather such additions to the forum participants, and offer as a general idea from many experienced users.


-- Alexander, private person, pacifist, english only with translator 🙂 --

Object-modeling _ odclass-odedit.com _ Help

19,972 Views
118 Replies
Replies (118)
Message 101 of 119

m_badran
Advocate
Advocate
hi CADaSchtroumpf ,
thank you for your lisp,can you modify the lisp to select a multiple polyline for storing from single Text to an OD.
any help appreciated.
0 Likes
Message 102 of 119

CADaSchtroumpf
Advisor
Advisor

Hi m_bradan,

 

Can you be more specific, because I don't understand your request.

Which routine is affected? (I've posted so many more)

Want to transfer the UNIQUE value of a text to a many polyline object data table at once?

0 Likes
Message 103 of 119

m_badran
Advocate
Advocate

Hi CADaSchtroumpf,

I talk about your lisp Text_Sel2OD_en. can you please modify it to take data from selected single text to applied to multiple poly-line

0 Likes
Message 104 of 119

АлексЮстасу
Advisor
Advisor

If CADaSchtroumpf writes such a program, it will be better because - for all AutoCAD.
If you have 2020 or older, there is ODEDIT_SETTEXT.

 


-- Alexander, private person, pacifist, english only with translator 🙂 --

Object-modeling _ odclass-odedit.com _ Help

0 Likes
Message 105 of 119

m_badran
Advocate
Advocate

Hi АлексЮстасу ,

I know about ODEDIT_SETTEXT but it not the good solution for me cause own DWG text not existing beside the poly-line also text not
allowed for all objects.
thank for reply.

0 Likes
Message 106 of 119

АлексЮстасу
Advisor
Advisor

I think I misunderstood your task.


You need to pass the content of one text element to the OD of many polylines?
Why not copy the content of that text, directly into the OD of those polylines? Just through the Properties window?

 

Maybe you could attach an example dwg here with an explanation of the task?

 


-- Alexander, private person, pacifist, english only with translator 🙂 --

Object-modeling _ odclass-odedit.com _ Help

0 Likes
Message 107 of 119

m_badran
Advocate
Advocate

Capture.JPG

Attached files may be clarify my target.

 

 

0 Likes
Message 108 of 119

CADaSchtroumpf
Advisor
Advisor

@m_badran 

Try this version...

(defun ListBox (title msg keylab flag / tmp file dcl_id choice)
  (setq
    tmp (vl-filename-mktemp "tmp.dcl")
    file (open tmp "w")
  )
  (write-line
    (strcat "ListBox:dialog{label=\"" title "\";")
    file
  )
  (if (and msg (/= msg ""))
    (write-line (strcat ":text{label=\"" msg "\";}") file)
  )
  (write-line
    (cond
      ((= 0 flag) "spacer;:popup_list{key=\"lst\";")
      ((= 1 flag) "spacer;:list_box{key=\"lst\";")
      (T "spacer;:list_box{key=\"lst\";multiple_select=true;")
    )
    file
  )
  (write-line "}spacer;ok_cancel;}" file)
  (close file)
  (setq dcl_id (load_dialog tmp))
  (if (not (new_dialog "ListBox" dcl_id))
    (exit)
  )
  (start_list "lst")
  (mapcar 'add_list (mapcar 'cdr keylab))
  (end_list)
  (action_tile
    "accept"
    "(or (= (get_tile \"lst\") \"\")
      (if (= 2 flag)
        (progn
          (foreach n (str2lst (get_tile \"lst\") \" \")
            (setq choice (cons (nth (atoi n) (mapcar 'car keylab)) choice))
          )
          (setq choice (reverse choice))
        )
        (setq choice (nth (atoi (get_tile \"lst\")) (mapcar 'car keylab)))
      )
    )
    (done_dialog)"
  )
  (start_dialog)
  (unload_dialog dcl_id)
  (vl-file-delete tmp)
  choice
)
(defun sel_onlyText (msg / js)
  (princ msg)
  (while
    (not
      (setq js
        (ssget "_+.:E:S:N" 
          (list
            (cons 0 "*TEXT,MULTILEADER,ATTRIB,INSERT,DIMENSION")
            (cons 67 (if (eq (getvar "CVPORT") 2) 0 1))
            (cons 410 (if (eq (getvar "CVPORT") 2) "Model" (getvar "CTAB")))
          )
        )
      )
    )
  )
  (vlax-ename->vla-object (cadar (ssnamex js 0)))
)
(defun C:Text_Sel2Multi-OD ( / AcDoc Space l_tab tab_target list_field_target l_field field_target typ_target e_name string js_target n ent)
  (setq
    AcDoc (vla-get-ActiveDocument (vlax-get-acad-object))
    Space
    (if (eq (getvar "CVPORT") 1)
      (vla-get-PaperSpace AcDoc)
      (vla-get-ModelSpace AcDoc)
    )
  )
  (setq l_tab (ade_odtablelist))
  (cond
    ((setq tab_target (listbox "TABLES" "Select the Target OD Table " (mapcar 'cons l_tab l_tab) 1))
      (setq
        list_field_target (ade_odtabledefn tab_target)
        l_field (mapcar 'cdr (mapcar 'car (cdaddr list_field_target)))
      )
      (while (setq field_target (listbox "CHAMPS" (strcat "Select the Target OD Field for The Table " tab_target) (mapcar 'cons l_field l_field) 1))
        (setq typ_target (cdr (assoc "ColType" (assoc (cons "ColName" field_target) (cdaddr list_field_target)))))
        (alert (strcat "The type data will be " typ_target ))
        (setq e_name (sel_onlyText (strcat "\nSelect the Source Text for " field_target ": ")))
        (setq string
          (cond
            ((vlax-property-available-p e_name 'TextString) (vlax-get e_name 'TextString))
            ((vlax-property-available-p e_name 'Measurement)
              (if (eq (vlax-get e_name 'TextOverride) "")
                (rtos (vlax-get e_name 'Measurement) 2 8)
                (vlax-get e_name 'TextOverride)
              )
            )
          )
        )
        (cond
          (string
            (princ "\nSelect objects for storing the Text to an OD ")
            (while
              (null
                (setq js_target
                  (ssget
                    (list
                      (cons 0 "*")
                      (cons 67 (if (eq (getvar "CVPORT") 2) 0 1))
                      (cons 410 (if (eq (getvar "CVPORT") 2) "Model" (getvar "CTAB")))
                    )
                  )
                )
              )
            )
            (repeat (setq n (sslength js_target))
              (setq ent (ssname js_target (setq n (1- n))))
              (cond
                ((member tab_target (ade_odgettables ent))
                  (ade_odsetfield ent tab_target field_target 0
                    (cond
                      ((eq typ_target "Character") string)
                      ((eq typ_target "Integer") (atoi string))
                      ((eq typ_target "Real") (atof string))
                    )
                  )
                  (princ (strcat "\nThe Value " (cond ((eq typ_target "Character") string) ((eq typ_target "Integer") (itoa (atoi string))) (T (rtos (atof string)))) " is stored to the Field " field_target))
                )
                (T (princ (strcat "\nThe Table " tab_target " is not attached to the selected object ! ")))
              )
            )
          )
        )
      )
    )
  )
  (prin1)
)
Message 109 of 119

m_badran
Advocate
Advocate

Thank you very much ,exact that what i want.

 

0 Likes
Message 110 of 119

braudpat
Mentor
Mentor

Hello

 

1) A new Lisp routine for ODs from ACAD MAP / ACAD CIVIL

 

2) The "OD_Pref_Suff_Text" routine adds Prefix and / or Suffix to a Text OD Field

 

3) The routine has no error management so :

-- Please give the EXACT Names for the OD Table & OD Field

-- Please select ONLY Entities with the RIGHT OD Table

 

The Health, Bye, Patrice (The Old French EE Froggy)

 

Patrice ( Supporting Troops ) - Autodesk Expert Elite
If you are happy with my answer please mark "Accept as Solution" and if very happy please give me a Kudos (Felicitations) - Thanks

Patrice BRAUD

EESignature


Message 111 of 119

braudpat
Mentor
Mentor

Hello

 

10) Two new Lisp routine for ODs from ACAD MAP / ACAD CIVIL

They are derivated from the previous "OD_Pref_Suff_Text.lsp" routine ...

 

21) The "OD_Add_Numeric" routine adds a positive or negative Value to a Numeric OD Field

22) The "OD_Mul_Numeric" routine multiplys with a positive or negative Value to a Numeric OD Field

 

30) The routines has no error management so :

-- Please give the EXACT Names for the OD Table & OD Field

-- Please select ONLY Entities with the RIGHT OD Table

 

The Health, Bye, Patrice (The Old French EE Froggy)

Patrice ( Supporting Troops ) - Autodesk Expert Elite
If you are happy with my answer please mark "Accept as Solution" and if very happy please give me a Kudos (Felicitations) - Thanks

Patrice BRAUD

EESignature


Message 112 of 119

braudpat
Mentor
Mentor

Hello @АлексЮстасу 

 

An other great routine for ODs (Object Data) of ACAD MAP / ACAD CIVIL from Bruno / CADaSchtroumpf !

 

The routine "OD_Change_String" lets you search and replace string / text from OD Table

and of course from only String / Text OD Field !


;;
;; This routine is a "Search and Replace" ONLY for String / Text OD Field ...
;;
;; !! ONLY the FIRST found String / Text will be replaced !!
;;
;; !! Please be careful with the "Search Text/String" because MANY replacements can be done !!
;;

 

An other solution would be to use the fabulous DLL from Olivier Eckmann

and the 2 commands : MAPODOUT , MAPODIN

 

The Health, Bye, Patrice

 

Patrice ( Supporting Troops ) - Autodesk Expert Elite
If you are happy with my answer please mark "Accept as Solution" and if very happy please give me a Kudos (Felicitations) - Thanks

Patrice BRAUD

EESignature


Message 113 of 119

noambbb
Contributor
Contributor

Is there a ODEDIT_2021 version?

0 Likes
Message 114 of 119

АлексЮстасу
Advisor
Advisor

Unfortunately I do not have the ability to make versions for AutoCAD Map/Civil 2020 and newer.

 

On the other hand, I didn't have convincing feedback from the very beginning and now I don't have any evidence that ODCLASS & ODEDIT are in demand by a significant number of users.

 


-- Alexander, private person, pacifist, english only with translator 🙂 --

Object-modeling _ odclass-odedit.com _ Help

0 Likes
Message 115 of 119

braudpat
Mentor
Mentor

Hello @АлексЮстасу 

 

A new version 4.0 of the routine "OD2Label_Side" for ODs (Object Data) of ACAD MAP / ACAD CIVIL from Bruno / CADaSchtroumpf !

 

Improvments are :

 

1) All objects are now usable for "OD2Label_Side" vs 4.0 !

"*POLYLINE,LINE,ARC,CIRCLE,ELLIPSE,SPLINE,*TEXT,INSERT,POINT,MPOLYGON"

 

2) A TEXT (with Style  = "OD_Label") is created and not a MTEXT

 

3) TEXTS are created on a specific layer (Color = 33) :

"OD_Label___TableOD___FieldOD"

So now you have Texts coming from multiple ODs on multiple layers ...

 

THANKS to Bruno / CADaSchtroumpf !

 

The Health, Bye, Patrice (The Old French EE Froggy)

 

 

Patrice ( Supporting Troops ) - Autodesk Expert Elite
If you are happy with my answer please mark "Accept as Solution" and if very happy please give me a Kudos (Felicitations) - Thanks

Patrice BRAUD

EESignature


Message 116 of 119

lglowackiGCI
Explorer
Explorer

Hi,

 

I encountered a strange situation. I don't know how it happened but two features were added to one polyline in single DATA TABLE. 

 

In the properties window, poly OD is displayed as one feature . You can see it on the attached printscreen.

 

Can sombody explain why that happened?

0 Likes
Message 117 of 119

O_Eckmann
Mentor
Mentor

Hi,

 

Normally you have only one record per object, but you can add as many record you want to single object.

In properties palet AutoCAD shows only 1st record.

To see all records you can use ADEEDITDATA . In your file you obtain

oliviereckmann_0-1669369404418.png

You find number of record and buttons Next, Previous, First, Last to move inside all records and one button to remove the current record.

 

Olivier

Olivier Eckmann

EESignature

Message 118 of 119

lglowackiGCI
Explorer
Explorer
Many thanks!
0 Likes
Message 119 of 119

CADaSchtroumpf
Advisor
Advisor

If you are SURE you only want to keep the last data record for your entire drawing, you can use this to clean all fields from all tables of superfluous records.

 

(defun c:del_record_other0 ( / js n obj tbllist numrec ct lst)
  (setq js
    (ssget "_X"
      (list
        (cons 67 (if (eq (getvar "CVPORT") 1) 1 0))
        (cons 410 (if (eq (getvar "CVPORT") 1) (getvar "CTAB") "Model"))
      )
    )
    lst nil
  )
  (cond
    (js
      (repeat (setq n (sslength js))
        (setq obj (ssname js (setq n (1- n))))
        (setq tbllist (ade_odgettables obj))
        (cond
          (tbllist
            (foreach tbl tbllist
              (setq numrec (ade_odrecordqty obj tbl))
              (cond
                ((> numrec 1)
                  (setq ct (1- numrec))
                  (while (not (zerop ct))
                    (ade_oddelrecord obj tbl ct)
                    (setq ct (- ct 1))
                  )
                  (if (not (member tbl lst))
                    (setq lst (cons tbl lst))
                  )
                )
              )
            )
          )
        )
      )
    )
  )
  (if lst
    (mapcar '(lambda  (x) (princ (strcat "\nLa table " x " à été nettoyée"))) lst)
    (princ "\nAucune table à nettoyer.")
  )
  (prin1)
)