export Aecc objects in objectDBX opened mode

export Aecc objects in objectDBX opened mode

SAPER59
Advocate Advocate
1,037 Views
7 Replies
Message 1 of 8

export Aecc objects in objectDBX opened mode

SAPER59
Advocate
Advocate

I need to extract AECC objects from a DWG opening in a ObjectDBX mode, and import them in the current DWG

I can't using vla-copyobjects 

 

(setq retObject
(vla-copyobjects
odbx
objCollection
(vla-get-modelspace (vla-get-database Cur_acadDoc))
)
)

neither with  vla-Wblock  methods

(vla-Wblock odbx "G:/example.dwg" gr2export)

 

gr2export is the ssget of AECC from odbx dwg opened

 

Can anybody let me know  how to do this.

Thanks in advance

0 Likes
1,038 Views
7 Replies
Replies (7)
Message 2 of 8

ronjonp
Mentor
Mentor

I have not done this in a while but I think You need to iterate modelspace in the ODBX drawing and identify what is an AECC object via vla-get-objectname. Then store the objects in a list and use: 

 

(vlax-invoke
  (setq ad (vla-get-activedocument (vlax-get-acad-object)))
  'copyobjects
  ("your list of objects stored in a variable from odbx doc")
  (vla-get-modelspace ad)
  nil
)

 

0 Likes
Message 3 of 8

SAPER59
Advocate
Advocate

I  tried your function and It gives me this error

error: AutoCAD.Application: Object not in database

The list of VLA objects is OK and each object can be displayed, so it seems it searchs in the current DWG and instead  it would need to know where the VLAObjects belong to in order to copy from. Both refference belong to active document and no to ODBX.

0 Likes
Message 4 of 8

john.uhden
Mentor
Mentor

With AECC thingies, like in C3D, there are so many things "attached" to other things.  Like at work today I found that a C3D label thingy made by our endeavoring CAD monkey could not be copied by itself,  Instead you had to copy both the label and the line to which it was "attached."  So I presume you are running into the same or similar problem, for which I have no solution to offer as yet.  😞

I used to take apart and put back together things in Land Desktop, but I was stagnant for over 9 years and this C3D world (into which I entered just three months ago) has a lot of dark caves.

I wonder if @Jeff_M can help.  Try posting your question in the C3D Customization forum.  I think Jeff spends most of his play time there.

John F. Uhden

0 Likes
Message 5 of 8

Sea-Haven
Mentor
Mentor

Civ3d has a few gotcha like in another place altogether for an answer as you suggested working with styles can be difficult. 

 

Something I did was write Import description keys as you can export to excel but not import that opened a few of the hidden "tree" answers. Why does Civ3d not have a import description keys ? Know about Importstylesandsettings.

 

Another is Contours I have a toolbar for toggling contour settings avoids the horrible Toolspace, anybody wants info have a look at this.

 

Another is point styles not using toolspace.

 

0 Likes
Message 6 of 8

Jeff_M
Consultant
Consultant

What are you trying to copy? Could you provide your full code and the drawing you are copying from? 

 

Working with Civil 3D objects can be tricky, even more so when using lisp/COM. As @john.uhden mentioned, C3D customization will get better attention over in the C3D Customization forum.

Jeff_M, also a frequent Swamper
EESignature
0 Likes
Message 7 of 8

SAPER59
Advocate
Advocate

In the 6th Alignment DWG I have the station values define by Civil as
"AECC_ALIGNMENT_STATION_LABEL_GROUP" and Center lines defined as "AECC_ALIGNMENT"
In the dwg I can get their values exploding it 2 times and getting the text value ant the intersection of 2 lines as point for this station value
Because this file is used as XREF for all the job but need this values to work inside, I would like to open in objectDBX mode this alignment file, export this AECC objects to a new DWG to be used as block, and then import this new block in the current DWG, and there explode the objects until getting the objects to get the values needed

0 Likes
Message 8 of 8

Sea-Haven
Mentor
Mentor

This may be usefull.

 

; Recreate Alignments as plines arcs and lines this version
; by Alan H Jan 2019

(defun ahdoaline (ob / pt1 pt2 )
(setq pt1 (list (vlax-get ob 'StartEasting) (vlax-get ob 'StartNorthing)) )
(setq pt2 (list (vlax-get ob 'EndEasting) (vlax-get ob 'EndNorthing)) )
(command "Line" Pt1 pt2 "")
)

(defun ahdoaarc (ob / pt1 pt2 )
(setq pt1 (list (vlax-get ob 'StartEasting)(vlax-get ob 'StartNorthing)))
(setq pt2 (list (vlax-get ob 'EndEasting) (vlax-get ob 'EndNorthing)))
(setq rad (vlax-get ob 'Radius))
(setq pt3 (vlax-get ob 'PassThroughPoint1))
(command "ARC" Pt1 pt3 pt2 )
)

 ; version check see vercheck.lsp
(defun al-plines ( / lst typ x det ob  )
(vl-load-com)
(if (not ah:vercheck)(load "vercheck"))
(ah:vercheck) 
   
(setq lst '())   
(vlax-for j (vlax-get *AeccDoc* 'AlignmentsSiteless)
(setq lst (cons (cons (vla-get-name j) j) lst))
)

(command "-layer" "m" "Align" "")
(repeat (setq x (length lst))
(setq det (cdr (nth (setq x (- x 1)) lst)))
(setq ents  (vlax-get det 'Entities))
(vlax-for ob ents
(setq typ (vlax-get ob 'type))
(cond
((= typ 1)(ahdoaline ob))
((= typ 2)(ahdoaarc ob))
)
)
)
)
(al-plines)
0 Likes