Jump to content

Help with 3D terrain model DTM.


Costinbos77

Recommended Posts

Sorry, but I do not know AutoCAD Civil 3D 2012. Here we try to create our own programs to do what you said. Start a new topic and it will be directed where it belongs.

Link to comment
Share on other sites

  • Replies 28
  • Created
  • Last Reply

Top Posters In This Topic

  • Costinbos77

    14

  • irneb

    4

  • ymg3

    4

  • Organic

    2

Top Posters In This Topic

Friends.............pls help me. I used to create surface (terrain) in Land Desktop 2009 for contour and spot levels from existing text file data (PENZD format). Now my laptop has been upgraded with 64bits OS Win 7 where the land desktop 2009 can't be loaded. I have auto cad civil 3d 2012 in my laptop but I can't create the terrain from the said text file data. It will become great hazards to me. I am a Surveyor and my work related with surface, cotour, spot level, cross section, long section, volume etc. I have also read so many suggestions from various site but still i can't understand properly. It is requested to all of you if any forum member belongs to Kolkata, India; pls help me to learn those things. pls....pls....

 

See

Link to comment
Share on other sites

  • 3 weeks later...

For ymg3 :

Maybe you find it interesting and you have a new idea for my program, does not work as I would like:

 


(defun C:ScalareM3Dx (/ coSf ent lTe sF tip z)
(setVar "CmdEcho" 0)
(setVar "OrthoMode" 0)

(prinC (strCat "\n   Selects  TIN  for Scale  :\n  [ PolyFaceMesh ]  ;  Enter = Stop  :  "))
;;; (prinC (strCat "\n   Selects  TIN  for Scale  :\n  [ 3D Face , 3D Solid , PolyFaceMesh ]  ;  Enter = Stop  :  ")) ;_ end of p
;;; (if (and (setq sel (ssGet (list '(-4 . "<or") '(0 . "3DFace") '(0 . "3DSolid") '(-4 . "<and") '(0 . "PolyLine") 
                                      '(70 . 64) '(-4 . "and>") '(-4 . "or>")) ) ) ;_ end of setq
(if (and (setq sel (ssGet '((0 . "PolyLine") (70 . 64)) ) ) ;_ end of setq
     (= (ssLength sel) 1) ) ;_ end of and
 (progn
  (setq ent (ssName sel 0)  myTinV (vlax-eName->vla-Object ent)  tip (vla-Get-ObjectName myTinV)  str (vla-Get-Layer myTinV)  s0 1  z0 0) ;_ end of setq
  (if (= tip "AcDbPolyFaceMesh")
   (progn
    (setq verN (vla-Get-NumberOfVertices myTinV)  faceN (vla-Get-NumberOfFaces myTinV)  lEnt (entGet ent '("Scalare Model 3D")) ) ;_ end of setq
    (vla-GetBoundingBox myTinV 'pMin 'pMax)
    (setq pC (mapcar '(lambda (e) (/ e 2.)) (mapcar '+ (vlax-SafeArray->List pMin) (vlax-SafeArray->List pMax))) ) ;_ end of setq

    (if (setq lXdata (cdadr (assoc -3 lEnt)) ) ;_ end of setq
     (progn ; then
      (setq z0 (cdr (assoc 1040 lXdata))  s0 (cdr (assoc 1042 lXdata)) ) ;_ end of setq
     ) ;_ end of prog then
     (progn ; else
      (regApp "Scalare Model 3D")
      (setq lNew (append lEnt (list (list -3 (list "Scalare Model 3D" '(1000 . "Plan de Referintã  Z 0 : Cod 1040 .") (cons 1040 z0) (cons 1042 s0) ))) )  ) ;_ end of setq
      (entMod lNew) ;(entUpd ent) ;(entGet (car (entSel)) '("Scalare Model 3D"))
    ) ) ;_ end of if lXdata
;;; (setq lobx (entGet ent '("Scalare Model 3D"))  lxdata (cdr (assoc -3 lobx))  ) ;_ end of setq

;;;(setq DataType (vlax-Make-Safearray vlax-vbInteger '(0 . 2)))
;;;(setq DataV (vlax-Make-Safearray vlax-vbVariant '(0 . 2)))
;;;(vlax-SafeArray-Fill DataType '(1001 1040 1042)) ; Conteaza Codurile !
;;;(vlax-SafeArray-Fill DataV '("Scalare Model 3D" z0 s0)) ; Conteaza Codurile !
;;;(vla-SetXData lineObj DataType DataV)

;;; (vla-GetXData entV "Scalare Model 3D" 'varType 'varValue) ; (3)
;;; (setq lXdataV (vlax-SafeArray->List varValue))
;;; (setq lXdata (mapcar 'vlax-Variant-Value lXdataV))
  ) ) ;_ end of if tip

  (setq AcadObj (vlax-Get-Acad-Object)  ActDoc (vla-get-ActiveDocument AcadObj)  MSpace (vla-get-ModelSpace ActDoc) )
  (setq cd 0  c3 nil  coRot "Rotire"  pC0 pC  vtt 0) ;_ end of setq
  (setq lays (vla-Get-Layers actDoc)  lisLay (list str))
  (setVar "cLayer" str)
  (vlax-For lay lays (setq nLay (vla-Get-Name lay)) (if (= (vla-Get-Freeze lay) :vlax-True) (setq lisLay (cons nLay lisLay))
            (if (/= nLay str) (vla-Put-Freeze lay :vlax-True)) )  ) ;_ end of for

;;;   (setq ViewCol (vla-Get-Views ActDoc))
;;;   (setq ViewObj (vla-Add ViewCol "NewView1"))
;;;   (setq AcVp (vla-Get-ActiveViewport ActDoc))

  (while
   (progn 
    (if (/= cd 5)
     (progn
      (setq lisCooVV (vlax-Variant-Value (vla-Get-Coordinates myTinV))  
              lLisCooVV (vlax-SafeArray-Get-U-Bound lisCooVV 1)  zMin 10e9  zMax (- zMin)  i -1) ;_ end of setq
      (while (< i lLisCooVV) (setq i (+ i 3)  z (vlax-SafeArray-Get-Element lisCooVV i)  zMin (min zMin z)  zMax (max zMax z)) ) ;_ end of wh

      (prinC (strCat "\n - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ."
             "\n   Tip  TIN  :  " tip "  ;   Vertex  =  " (ItoA verN) " ;  Faces  =  " (ItoA faceN) "  ;"
                     "\n   Z min  =  " (RtoS zMin 2 3) "  ;  Z max  =  " (RtoS zMax 2 3) "  ;  Left Click  =  " coRot "  ;  Enter  =  Stop  ;"
             "\n   Z 0  =  " (RtoS z0 2 3) "  ;   Enter  =  Stop  ;    <  Scale  Factor  =  " (RtoS s0 2 3) "  >  : ")) ;_ end of p (chr 186) = °
    )) ;_ end of if (/= cd 5)

    (and (not (member (setq gr ([color=blue]grRead[/color] T 15 0)  vt (cadr gr)  cd (car gr)) '(3333 25)) ) ; 3=Clic St , 25=Clic Dr
     (not (member vt '(13 32)) )  ) ; Enter , Spatiu Key
   ) ;_ end of prog cond


   (if (and c3 (= cd 5) (setq vt1 (trans vt 0 2 nil)) (not (equal vt1 vtt (expT 2 (strLen (RtoS (car vt1) 2 0))) ))) ; 20 - 30
    (progn
;;;      (reDraw)
     (setq vtt vt1)
     (vl-cmdF "dView" "all" "" "point" vt pC "")

;;;      (vla-Put-Direction ViewObj (vlax-3D-Point vt))
;;;      (vla-SetView AcVp ViewObj)
;;;      (vla-Put-ActiveViewport ActDoc AcVp)
     (grDraw pC vtt 1)
   )) ;_ end of if 

   (if (= cd 3) (progn (if c3 (setq c3 nil  coRot "Rotate") (setq c3 T  coRot "Stagnate")) (setq vtt '(0 0 0) ) (reDraw) )) ;_ end of if
   (if (member vt '(44 46 48 49 50 51 52 53 54 55 56 57)) (setq coSF (getString (strCat "\n   New  Scale  Factor   :  <  "(RtoS s0 2 3) "  >  :  ") )) ) ;_ end of if

   (if (and coSF (> (setq sf (AtoF coSF)) 0))
    (progn
     (setq coSF nil  zR (/ (* (+ zMin z0) (1- sF)) s0)  sR (/ sF s0)  i -1) ;_ end of setq

     (repeat verN (setq i (+ i 3)  zN (- (* (+ (vlax-SafeArray-Get-Element lisCooVV i) z0) sR) zR) ) (vlax-SafeArray-Put-Element lisCooVV i zN) ) ;_ end of r
     (vla-Put-Coordinates myTinV lisCooVV)
     (vla-GetXData myTinV "Scalare Model 3D" 'DataType 'DataVal)
     (vlax-SafeArray-Fill DataVal (list "Scalare Model 3D" "Plan de Referintã  Z 0 : Cod 1040 ." zR sF))
     (vla-SetXData myTinV DataType DataVal)
     (vla-Update myTinV)
     (setq z0 zR  s0 sF) ;_ end of setq
   ) ) ;_ end of if vt
  ) ;_ end of wh

  (vlax-For lay lays (if (not (member (vla-Get-Name lay) lisLay)) (vla-Put-Freeze lay :vlax-False))  ) ;_ end of for
) ) ;_ end of if sel
(reDraw)

(princ "\n\n   END  :  Scale  Model 3 D  : " ) ;_ end of p
(setVar "CmdEcho" 1)
(princ)
)

 

The program is not ready, needs improvement.

 

It is about this:

http://www.cadtutor.net/forum/showthread.php?84856-grRead-function

Arges P-3D v 4.dwg

TIN 4.dwg

Edited by Costinbos77
Link to comment
Share on other sites

Costinbos,

 

The only difference is you are using 3dpolylines mesh instead of 3dfaces.

 

I would rather stick with the faces representation.

 

ymg

Link to comment
Share on other sites

Ok. Have you tested?

 

This program not creates TIN model, but it scales the coordinates Z and it rotates the model, for print or for a clearest view.

 

The program can be applied on objects 3DFace, but XData information, must be stored in another way (dictionary).

Edited by Costinbos77
Link to comment
Share on other sites

Costimbos,

 

I tried it. I had to add the following line:

 

 (or actdoc (setq actdoc (vla-get-activedocument (vlax-get-acad-object)))) 

 

To make it work.

 

Now it does rotate but somewhat erratically. But as you said still need some more work.

 

You are getting there.

 

ymg

Link to comment
Share on other sites

Variable actDoc missing, because I set it in another function 'Start' (and many other variables) and I omitted to add. You test and with TIN 4.dwg‎ ?

 

Any suggestions?

Edited by Costinbos77
Link to comment
Share on other sites

I have found that, when drawing contains many entities, regeneration is difficult, so I completed the program with a sequence of layers freezing.

This helps a lot.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...