Fix routine - Multiply owned object

Fix routine - Multiply owned object

ВeekeeCZ
Consultant Consultant
952 Views
4 Replies
Message 1 of 5

Fix routine - Multiply owned object

ВeekeeCZ
Consultant
Consultant

Hi, I have wrote the simple routine for quick layer creation. 

 

Spoiler
(defun C:QL ( / :CopyLayer new old)
 (defun :CopyLayer (new old / ed ) 
  (if (setq ed (entget (tblobjname "LAYER" old)))
    (entmakex (subst (cons 2 new)
		     (assoc 2 ed)
		     ed))))

  (setq old (if (setq ssl (ssget "_I"))
	      (cdr (assoc 8 (entget (ssname ssl 0))))
	      (getvar 'CLAYER))
	new "")
  (while (or (not (snvalid new 0))
	     (tblsearch "LAYER" new))
    (setq new (lisped old)))
  (if (:CopyLayer new old)
    (setvar 'CLAYER new))
  (sssetfirst nil nil)
  (princ)
)

The routine does what I wanted to. But it looks that its causing same serious issues in the drawing - Multiply owned object. I really tried to find the problem... but I am missing something fundamental. It causes the same problem with both entmake and entmakex.

 

Here is the log from AUDIT command.

 

Spoiler
Command: AUDIT

Fix any errors detected? [Yes/No] <N>:



Auditing Header


Auditing Tables


Auditing Entities Pass 1

Pass 1 12200   objects audited
Auditing Entities Pass 2

Pass 2 12200   objects auditedAcDbLayerTableRecord: "v_infr_n_DS++"
      Extension dictionary 149D3B Not this object       Set to this
AcDbLayerTableRecord: "v_infr_n_DS++"
                                  was not repaired.

Auditing Blocks


 38      Blocks audited

Total errors found 1 fixed 0

Erased 0 objects

Thanks in adnvance.

0 Likes
953 Views
4 Replies
Replies (4)
Message 2 of 5

Ajilal.Vijayan
Advisor
Advisor

Hi BeekeeCZ,

I think the error only occurs when you are creating a new layer with the copy of Layer 0.

As layer 0 has some special role in autocad, may be your new layer also inheriting those properties.

I tried by creating a new layer manually and set that new layer as current.

Then I tried QL command and AUDIT didn't report any error.

0 Likes
Message 3 of 5

ВeekeeCZ
Consultant
Consultant

Not sure if the sample helps, but here it is. (edit: wrote before i saw the Ajilals reply)

 

Using Autocad 2012.

(edit: Keep the sample as it is (no change of current layer or anything)

 

I try copybase with the object... works fine.

I pre-select the object and run routine QL: I add the suffix "++"... it creates the new layer.

I try copybase with the object again ...then I get: *Warning* Multiply owned object, handle "4F"

 

 

0 Likes
Message 4 of 5

Ajilal.Vijayan
Advisor
Advisor

@ВeekeeCZ wrote:

I pre-select the object and run routine QL: I add the suffix "++"... it creates the new layer.


 When you run the routine QL: is the Currnet layer is 0 ?

  1. I tried with Current layer 0 and use QL to create a new layer, got the Multiply owned  error when use copybase command.
  2. Creating a new layer manually and that layer as currnet, use QL to create a new layer , didnt get any error when use copybase command.

In a new drawing can you try step no: 2 ?

Edit : Also if possible try by not making new layer in the code, if the Currnet layer is 0

0 Likes
Message 5 of 5

ВeekeeCZ
Consultant
Consultant

@Ajilal.Vijayan wrote:

 When you run the routine QL: is the Currnet layer is 0 ?

  1. I tried with Current layer 0 and use QL to create a new layer, got the Multiply owned  error when use copybase command.
  2. Creating a new layer manually and that layer as currnet, use QL to create a new layer , didnt get any error when use copybase command.

In a new drawing can you try step no: 2 ?

Also if possible try by not making new layer if the Currnet layer is 0


I'am playing whith that for a while... I tried that as well... it works fine. 0 layer as current does not effect anything.

I did not mention one important thing. These layers come from dgn->dwg conversing using Redline software. 

I thing I shoud replace (entmake (entsub)) with entmake layer creating from whole new list.

0 Likes