Author Topic: 340 entities update  (Read 2978 times)

0 Members and 1 Guest are viewing this topic.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
340 entities update
« on: June 17, 2008, 10:55:58 PM »
I'm wanting to do an entity update on an entity that has had its 340. <Ent .. > changed ...

no joy so far


and I'm wondering if I've missed something  ( ie : it can't be done :-) )


With Mechanical2007
i'm trying to replace the description in a Part Reference marker

Code: [Select]
(defun c:MATLReplace (/ eko)
  (setq eko (getvar "cmdecho"))
  (setvar "cmdecho" 0)
  (if (setq tmp
             (kdub:objsel "Select Material Marker entity" (list "ACMPARTREF") nil)
      )
    (progn (setq *lent*    (entget (car tmp))
                 *lent340* (entget (cdr (assoc 340 *lent*)))
                    )
           (if (setq index (vl-position '(1 . "DESCR") *lent340*))
             (progn (setq *lent340* (kdub:replaceItemInList *lent340*
                                                       (1+ index)
                                                       (cons 2 "New Description")
                                    )
                    )
                    (entmod *lent340*)
                    (entmod *lent*)
             )
           )
    )
  )
  (setvar "cmdecho" eko)
  (princ)
)

The datalist is being changed sucessfully, but the entity is returning nil from the entmod function.

here's what should be hapenning
Select a Marker.
Retrieve the marker entity Data
Retrieve the 340.entity from the Data
Find the index of the cons item to replace.
Replace the cons list.
entmod the 340.entity.
entmod the marker entity.

The data looks like this :-

Quote
((-1 . <Entity name: 7edae010>) (0 . "ACMPARTREF")
                                (5 . "412")
                                (102 . "{ACAD_REACTORS")
                                (330 . <Entity name: 7efdffb8>)
                                (102 . "}")
                                (330 . <Entity name: 7efddcf8>)
                                (100 . "AcDbEntity")
                                (67 . 0)
                                (410 . "Model")
                                (8 . "AM_12")
                                (100 . "AcmSymbolClass")
                                (10 541.082 134.228 0.0)
                                (11 1.0 0.0 0.0)
                                (12 0.0 1.0 0.0)
                                (40 . 10.0)
                                (1 . "ISO")
                                (100 . "AcmPartRef")
                                (340 . <Entity name: 7efdffb8>) <<-- this is the entity reference I'm changing
                                (280 . 1)
                                (340 . <Entity name: 7edae008>)
)

((-1 . <Entity name: 7efdffb8>) (0 . "ACMDATAENTRYPART")
                                (5 . "40F")
                                (102 . "{ACAD_REACTORS")
                                (330 . <Entity name: 7efdf440>)
                                (102 . "}")
                                (330 . <Entity name: 7efdf440>)
                                (100 . "AcmDataEntry")
                                (90 . 2)
                                (90 . 5)
                                (1 . "BOM_UNITS")
                                (2 . "ea")
                                (3 . "")
                                (1 . "DESCR")
                                (2 . "150 UB 14")
                                (3 . "")
                                (1 . "STANDARD")
                                (2 . "1000")
                                (3 . "")
                                (1 . "MATERIAL")
                                (2 . "300PLUS")
                                (3 . "")
                                (1 . "MASS")
                                (2 . "14.0")
                                (3 . "")
                                (90 . 1)
                                (10 0.0 0.0 0.0)
 < trim>)


The revised 340.entity data updates correctly, and looks like this :-
Quote
((-1 . <Entity name: 7efdffb8>) (0 . "ACMDATAENTRYPART")
                                (5 . "40F")
                                (102 . "{ACAD_REACTORS")
                                (330 . <Entity name: 7efdf440>)
                                (102 . "}")
                                (330 . <Entity name: 7efdf440>)
                                (100 . "AcmDataEntry")
                                (90 . 2)
                                (90 . 5)
                                (1 . "BOM_UNITS")
                                (2 . "ea")
                                (3 . "")
                                (1 . "DESCR")
                                (2 . "New Description")
                                (3 . "")
                                (1 . "STANDARD")
                                (2 . "1000")
                                (3 . "")
                                (1 . "MATERIAL")
                                (2 . "300PLUS")
                                (3 . "")
                                (1 . "MASS")
                                (2 . "14.0")
                                (3 . "")
                                (90 . 1)
                                (10 0.0 0.0 0.0)
 < trim>)


any ideas ?

I may need to go the ActiveX(COM) route, but in the mean time this problem has me entranced ...

 
« Last Edit: June 17, 2008, 10:59:24 PM by Kerry Brown »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: 340 entities update
« Reply #1 on: June 17, 2008, 11:35:20 PM »
Wild Guess
Could the Reactor be fighting you on the change?
Any way to turn it off while you are making the change?
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: 340 entities update
« Reply #2 on: June 17, 2008, 11:39:59 PM »
Hi Alan,
Machanical is enhanced considerably :) with reactors and they seem to be interlinked ( molasses)

I thought we may also have issues with custom objects, but I'm guessing.

I'll have a look at the reactors and see what we can do though, just in case.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: 340 entities update
« Reply #3 on: June 17, 2008, 11:43:58 PM »
ps:
Reading the values in the nested entities is no issue :-

Code: [Select]
(defun c:MATL (/ eko)
  (setq eko (getvar "cmdecho"))
  (setvar "cmdecho" 0)
  (if (setq tmp
             (kdub:objsel "Select Material Marker entity" (list "ACMPARTREF") nil)
      )
    (progn (setq *lent*              (entget (car tmp))
                 *lent340*           (entget (cdr (assoc 340 *lent*)))
                 PARTREF-Description (kdub:getass 2 (member '(1 . "DESCR") *lent340*))
                 PARTREF-Length      (kdub:getass 2 (member '(1 . "STANDARD") *lent340*))
                 PARTREF-Material    (kdub:getass 2 (member '(1 . "MATERIAL") *lent340*))
                 PARTREF-mass        (kdub:getass 2 (member '(1 . "MASS") *lent340*))
                 PARTREF-Count       (kdub:getass 94 *lent340*)
           )
           (print PARTREF-Count)
           (print PARTREF-Description)
           (print PARTREF-Length)
           (print PARTREF-Material)
           (print PARTREF-mass)
    )
  )
  (setvar "cmdecho" eko)
  (princ)
)

Returns:
Quote
Select Material Marker entity :
99
"150 UB 14xx"
"1000"
"300PLUS"
"14.0"
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

JohnK

  • Administrator
  • Seagull
  • Posts: 10669
Re: 340 entities update
« Reply #4 on: June 18, 2008, 10:38:33 AM »
Shot in the dark: Try an `entupd'.

I dont think it will work, because if your getting a `nil' from `entmod', i dont think its possible; you might just have to go the VL route.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: 340 entities update
« Reply #5 on: June 18, 2008, 03:55:27 PM »

John,
entupd refreshes graphical entitys .. it won't help unfortunately.

thanks anyway for the thought :-)
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

JohnK

  • Administrator
  • Seagull
  • Posts: 10669
Re: 340 entities update
« Reply #6 on: June 18, 2008, 06:48:44 PM »
Ah nuts. Sorry.

No prob.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

T.Willey

  • Needs a day job
  • Posts: 5251
Re: 340 entities update
« Reply #7 on: June 18, 2008, 06:56:20 PM »
I dont think it will work, because if your getting a `nil' from `entmod', i dont think its possible; you might just have to go the VL route.

This is the same thought I had.  Just to give you one more opinion.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.