Forum Sketchup Artlantis Archicad
Vous souhaitez réagir à ce message ? Créez un compte en quelques clics ou connectez-vous pour continuer.
Annonces
Bonjour Invité Bienvenue sur le forum biblio3d - le forum a été créé le Sam 19 Jan 2008 - 14:26- Nous avons enregistrés 14743 topics pour un total de : 174925 posts - le record de membres connectés simultanément :555
Galerie


comment modéliser un terrain d'après le fichier dwg du géomètre? - Page 3 Empty
Ton bloc notes
Derniers sujets
» [ LUMION ] 2024 - Importation FBX
par Lumion France Aujourd'hui à 16:42

» [ SKETCHUP tutos ] dessiner un dodécaèdre sans plugins
par tenrev Aujourd'hui à 14:22

» [ SKETCHUP plugins ] Plugin SOLID INSPECTOR - Nested Instances - Demande de clarification
par tenrev Aujourd'hui à 14:13

» [ SKETCHUP objets ] tiroir cuisine
par tenrev Aujourd'hui à 14:11

» [ LUMION ] 2024 - Importation FBX
par Shakna Aujourd'hui à 12:16

» [ LUMION ] Lumion 2024
par Shakna Aujourd'hui à 11:21

» [ TWINMOTION ] Appliquer un decal avec les outils spacing et area de Twinmotion 2024
par Gaspard Hauser Hier à 23:12

» [ TWINMOTION ] Nouvelle verion 2024
par Gaspard Hauser Mer 8 Mai 2024 - 10:27

» [ CHAINE TWITCH ] Pas simple de se faire un public
par tenrev Mar 7 Mai 2024 - 19:46

» [ INTELLIGENCE ARTIFICIELLE ] quelques video IA
par tenrev Mar 7 Mai 2024 - 9:47

» [ CHAINE TWITCH ] les replay de mes live sur Twitch
par tenrev Mar 7 Mai 2024 - 9:22

» [ SKETCHUP généralité ] Interpolation progressive entre deux formes le long d'un tracé
par JDD Lun 6 Mai 2024 - 15:19

» [ ARCHICAD ] Création de lucarne en 3D
par VertiKal Lun 6 Mai 2024 - 14:17

» [ SKETCHUP composants dynamiques ]
par simjoubert Lun 6 Mai 2024 - 10:39

» [ SKETCHUP plugins ]
par TIQUETM Dim 5 Mai 2024 - 19:39

» [ ARCHICAD ] raccourci clavier
par Taz Jeu 2 Mai 2024 - 16:04

» [ SKETCHUP Layout ] Layout 2024 probléme de Style
par tenrev Jeu 2 Mai 2024 - 11:58

» [ MATOS INFORM. ] LICENCES ARCHICAD
par yannickniort Mar 30 Avr 2024 - 8:29

» [ SKETCHUP plugins ] Universal Importer
par Samuel Tallet Lun 29 Avr 2024 - 19:18

» [ CHAINE TWITCH ] c'est reparti - pour quelques live
par tenrev Lun 29 Avr 2024 - 14:49

» [ SKETCHUP objets ]
par vick Mar 23 Avr 2024 - 20:52

» [ SKETCHUP vray ]
par furax49 Mar 23 Avr 2024 - 19:52

» [ ARTLANTIS ] Ca donne envie !
par loic46 Dim 21 Avr 2024 - 22:56

» [ SKETCHUP généralité ] sortie officielle de sketchup 2024
par tenrev Ven 19 Avr 2024 - 14:24

» [ ARTLANTIS ] Problème origine se déplace
par loic46 Jeu 18 Avr 2024 - 22:28

» [ SKETCHUP plugins ] Vms_up
par Rascal Jeu 18 Avr 2024 - 14:41

» [ SKETCHUP objets ] aquarium
par JDD Lun 15 Avr 2024 - 22:20

» [ ARCHICAD ] Zone - Menu déroulant
par Christophe Fortineau Jeu 11 Avr 2024 - 19:49

» [ SKETCHUP généralité ] Servimg Premium pour tous les membres
par tenrev Jeu 11 Avr 2024 - 14:31

» [ SKETCHUP plugins ] Move it
par TF3 Mer 10 Avr 2024 - 10:23

» [ SKETCHUP plugins ] curic 2D export
par tenrev Mar 9 Avr 2024 - 17:41

» [ SKETCHUP plugins ] profil builder 4 est disponible
par furax49 Mar 9 Avr 2024 - 17:00

» [ ARCHICAD ] Torsion sur poteaux
par Ti Pack Mar 9 Avr 2024 - 14:59

» [ PRESENTATION ]
par tenrev Lun 8 Avr 2024 - 8:22

» [ TWINMOTION ] bug d'affichage des textures avec le path tracer
par Gaspard Hauser Ven 5 Avr 2024 - 12:53

Sondage

Chaine Twitch

comment modéliser un terrain d'après le fichier dwg du géomètre? - Page 3 Poll_c1029%comment modéliser un terrain d'après le fichier dwg du géomètre? - Page 3 Poll_c10 29% [ 11 ]
comment modéliser un terrain d'après le fichier dwg du géomètre? - Page 3 Poll_c1011%comment modéliser un terrain d'après le fichier dwg du géomètre? - Page 3 Poll_c10 11% [ 4 ]
comment modéliser un terrain d'après le fichier dwg du géomètre? - Page 3 Poll_c103%comment modéliser un terrain d'après le fichier dwg du géomètre? - Page 3 Poll_c10 3% [ 1 ]
comment modéliser un terrain d'après le fichier dwg du géomètre? - Page 3 Poll_c108%comment modéliser un terrain d'après le fichier dwg du géomètre? - Page 3 Poll_c10 8% [ 3 ]
comment modéliser un terrain d'après le fichier dwg du géomètre? - Page 3 Poll_c108%comment modéliser un terrain d'après le fichier dwg du géomètre? - Page 3 Poll_c10 8% [ 3 ]
comment modéliser un terrain d'après le fichier dwg du géomètre? - Page 3 Poll_c108%comment modéliser un terrain d'après le fichier dwg du géomètre? - Page 3 Poll_c10 8% [ 3 ]
comment modéliser un terrain d'après le fichier dwg du géomètre? - Page 3 Poll_c1029%comment modéliser un terrain d'après le fichier dwg du géomètre? - Page 3 Poll_c10 29% [ 11 ]
comment modéliser un terrain d'après le fichier dwg du géomètre? - Page 3 Poll_c105%comment modéliser un terrain d'après le fichier dwg du géomètre? - Page 3 Poll_c10 5% [ 2 ]

Total des votes : 38

chaine sketchup.tv
Serveur Discord
Le Deal du moment : -39%
Pack Home Cinéma Magnat Monitor : Ampli DENON ...
Voir le deal
1190 €

comment modéliser un terrain d'après le fichier dwg du géomètre?

Page 3 sur 3 Précédent  1, 2, 3

Voir le sujet précédent Voir le sujet suivant Aller en bas

yayak
yayak
V.I.P.
V.I.P.
Masculin Humeur : www.lunik-be.com
Date d'inscription : 13/02/2010
Nombre de messages : 987
Points : 1231
Age : 47
Localisation : BAS-RHIN
Emploi : Maître d'Oeuvre
http://www.lunik-be.com

Messageyayak Dim 25 Avr 2010 - 9:18

merci Christophe, vais tester ! bravo2
Fab
Fab
modérateur
modérateur
Masculin Humeur : Rester COOL......
Date d'inscription : 03/10/2008
Nombre de messages : 4823
Points : 5411
Age : 57
Localisation : Normandie
Emploi : Dessinateur en bâtiment et génie civil
https://www.pinterest.fr/lignesvintage/_saved/

MessageFab Dim 25 Avr 2010 - 10:31

j'ai aussi le même problème, je vais essayer. aurevoir
c.plassais
c.plassais
modérateur
modérateur
Masculin Date d'inscription : 19/07/2009
Nombre de messages : 2058
Points : 2479
Age : 61
Localisation : Chambéry
Emploi : Responsable Gestion Atelier
http://bande.village.free.fr/

Messagec.plassais Dim 25 Avr 2010 - 10:57

Si vous avez un problème, dites le moi et je vous mets un lien en place pour les télécharger.
Par contre faites bien attention il faut installer la version 2 de delauney.rb (delauney2.rb ou fr_delauney2.rb)

@+
c.plassais
c.plassais
modérateur
modérateur
Masculin Date d'inscription : 19/07/2009
Nombre de messages : 2058
Points : 2479
Age : 61
Localisation : Chambéry
Emploi : Responsable Gestion Atelier
http://bande.village.free.fr/

Messagec.plassais Dim 25 Avr 2010 - 11:02

Sinon vous faites un copier coller du code suivant et vous le sauvergardez sous le nom de fr_points_cloud_triangulation.rb
Code:
# Copyright 2004, D. Bur, C. Fale

# Permission to use, copy, modify, and distribute this software for
# any purpose and without fee is hereby granted, provided that the above
# copyright notice appear in all copies.

# THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#-----------------------------------------------------------------------------
# Name        :  points_cloud_triangulation
# Description :  A tool to create triangles starting from a construction points selection
# Menu Item  :  Plugins -> Triangulate points
# Context Menu:  NONE
# Usage      :  Select construction points. Select menu Plugins/Triangulate points
#            :  read the status bar to check information about triangulation
# Date        :  9/17/2004
# Type        :  Tool
#-----------------------------------------------------------------------------

require 'fr_delauney2.rb'


def points_to_array(z)
  z = 1
  model = Sketchup.active_model
  model.start_operation "points triangulation"
  entities = model.active_entities
  ss = model.selection

  if ss.empty?
    UI.messagebox("Pas de selection !")
    return nil
  end

  # Selection error checking: eliminates the non-cpoint objects
  look = 1
  i = 0
  0.upto( ss.length - 1) do |look|
    if( not ss[i].kind_of? Sketchup::ConstructionPoint )
      look = 0
    end
    i = i + 1
  end  #of upto

  if(look == 0)
    UI.messagebox("Certain objet(s) de la selection ne sont pas des points de construction.")
    return nil
  end
 
  i = 0
  # Fill an array of 3D_points with selection
  points_array = Array.new(ss.length)

    # read the points in the file and create the vertex array
   
    for ind in (0..(ss.length - 1))
      cpt = ss[i]
      x = cpt.position[0].to_f
      y = cpt.position[1].to_f
      z = cpt.position[2].to_f
      points_array[ind] = [x, y ,z]

      i = i + 1
    end
   
  #points_array = points_array[0..points_array.length - 4]
  points_array.uniq!
  return points_array
 
end #of def


def triangulate_points

model = Sketchup.active_model
entities = model.active_entities

#-----------------------------------------------------------------------------    Layer settings
   set_layer_code = UI.messagebox("Mettre les triangles sur un calque specifique ?", MB_YESNO)
   if set_layer_code == 6
         prompts1 = ["Nom du calque"]
         values1 = ["Triangles"]
         results1 = inputbox prompts1, values1, "Nom du calque"
               if results1.to_s.empty? == true      # Deleted value handler
                  results1 = model.layers.unique_name("Triangles")
               elsif results1 == false
                  results1 = saved_layer.name
               end
      model.layers.add(results1.to_s)
      model.active_layer = (results1.to_s)
   end
       
z = 0
triangles = []
points_table = points_to_array(z)


# Takes as input a array with NVERT lines, each line is a array with three values x, y, and z (vertex[j][0] = x value of j + 1 component)

if points_table
  triangles = triangulate(points_table)
end

i = 0
0.upto( triangles.length - 1 ) do |something|
  indices = triangles[i]
  ind1 = indices[0]
  ind2 = indices[1]
  ind3 = indices[2]
 
  # Verbose
  print triangles.length.to_s
  print "\n"
 
  Sketchup.set_status_text("Ajout du triangle: "  + i.to_s + " / " + triangles.length.to_s )
 
  Sketchup.active_model.active_entities.add_face( points_table[indices[2]], points_table[indices[1]], points_table[indices[0]] )
  i = i + 1
end

end    #of def


if( not file_loaded?("fr_points_cloud_triangulation.rb") )
    add_separator_to_menu("Plugins")
    UI.menu("Plugins").add_item("Trianguler nuage de points") { triangulate_points }
end
file_loaded("fr_points_cloud_triangulation.rb")

et celui-ci sous le nom de fr_delauney2.rb

Code:

# Credit to Paul Bourke (pbourke@swin.edu.au) for original Fortran 77 Program :))
# August 2004 - Conversion and adaptation to Ruby by Carlos Falé (carlosfale@sapo.pt)
# September 2004 - Updated by Carlos Falé
#
# You can use this code, for non commercial purposes, however you like, providing the above credits remain in tact

# Return two logical values, first is TRUE if the point (xp, yp) lies inside the circumcircle made up by points (x1, y1), (x2, y2) and (x3, y3)
# and FALSE if not, second is TRUE if xc + r < xp and FALSE if not
# NOTE: A point on the edge is inside the circumcircle
def incircum(xp, yp, x1, y1, x2, y2, x3, y3)

  eps = 0.000001
  res = [FALSE, FALSE]

  if (y1 - y2).abs >= eps || (y2 - y3).abs >= eps
    if (y2 - y1).abs < eps
      m2 = -(x3 - x2) / (y3 - y2)
      mx2 = (x2 + x3) / 2
      my2 = (y2 + y3) / 2
      xc = (x1 + x2) / 2
      yc = m2 * (xc - mx2) + my2
    elsif (y3 - y2).abs < eps
      m1 = -(x2 - x1) / (y2 - y1)
      mx1 = (x1 + x2) / 2
      my1 = (y1 + y2) / 2
      xc = (x2 + x3) / 2
      yc = m1 * (xc - mx1) + my1
    else
      m1 = -(x2 - x1) / (y2 - y1)
      m2 = -(x3 - x2) / (y3 - y2)
      mx1 = (x1 + x2) / 2
      mx2 = (x2 + x3) / 2
      my1 = (y1 + y2) / 2
      my2 = (y2 + y3) / 2
      if (m1 - m2) == 0
        xc = (x1 + x2 + x3) / 3
        yc = (y1 + y2 + y3) / 3
      else
        xc = (m1 * mx1 - m2 * mx2 + my2 - my1) / (m1 - m2)
        yc = m1 * (xc - mx1) + my1
      end
    end

    dx = x2 - xc
    dy = y2 - yc
    rsqr = dx * dx + dy * dy
    r = Math.sqrt(rsqr)

    dx = xp - xc
    dy = yp - yc
    drsqr = dx * dx + dy * dy
    if drsqr < rsqr
      res[0] = TRUE
    end
   
    if xc + r < xp
      res[1] = TRUE
    end

  end

  return res

end

# Takes as input a array with NVERT lines, each line is a array with three values x, y, and z (vertex[j][0] = x value of j + 1 component) and
# return a array with NTRI lines, each line is a array with three values i, j, and k (each value is the index of a point in the input array (vertex array))
# i is the index of the first point, j is the index of the second point and k is the index of the third point,
def triangulate(vert)

  # Sort the input array in x values
 
 
  vert.sort!
 
  nvert = vert.length

  triang = Array.new
  edges = Array.new
  complete = Array.new

  # Verbose
  Sketchup.set_status_text("Demarrage de la triangulation de " + nvert.to_s + " points")

  # Find the minimum and maximum vertex bounds. This is to allow calculation of the bounding triagle
  xmin = vert[0][0]
  ymin = vert[0][1]
  xmax = xmin
  ymax = ymin

  for i in (2..nvert)
    x1 = vert[i - 1][0]
    y1 = vert[i - 1][1]
    xmin = [x1, xmin].min
    xmax = [x1, xmax].max
    ymin = [y1, ymin].min
    ymax = [y1, ymax].max
  end

  dx = xmax - xmin
  dy = ymax - ymin
  dmax = [dx, dy].max
  xmid = (xmin + xmax) / 2
  ymid = (ymin + ymax) / 2

  # Set up the supertriangle. This is a triangle which encompasses all the sample points. The supertriangle coordinates are added to the end
  # of the vertex list. The supertriangle is the first triangle in the triangles list.
  p1 = nvert + 1
  p2 = nvert + 2
  p3 = nvert + 3
  vert[p1 - 1] = [xmid - 2 * dmax, ymid - dmax, 0]
  vert[p2 - 1] = [xmid, ymid + 2 * dmax, 0]
  vert[p3 - 1] = [xmid + 2 * dmax, ymid - dmax, 0]
  triang[0] = [p1 - 1, p2 - 1, p3 - 1]
  complete[0] = FALSE
  ntri = 1

  # Include each point one at a time into the exixsting mesh
  for i in (1..nvert)
    xp = vert[i - 1][0]
    yp = vert[i - 1][1]
    nedge = 0
   
  # Verbose 
  Sketchup.set_status_text("Triangulation du point " + i.to_s + " / " + nvert.to_s)
 
    # Set up the edge buffer. If the point (xp, yp) lies inside the circumcircle then the three edges of that triangle are added to the edge buffer.
    j = 0
    while j < ntri
      j = j +1
      if complete[j - 1] != TRUE
        p1 = triang[j - 1][0]
   p2 = triang[j - 1][1]
   p3 = triang[j - 1][2]
   x1 = vert[p1][0]
   y1 = vert[p1][1]
   x2 = vert[p2][0]
   y2 = vert[p2][1]
   x3 = vert[p3][0]
   y3 = vert[p3][1]
   inc = incircum(xp, yp, x1, y1, x2, y2, x3, y3)
   if inc[1] == TRUE
     complete[j - 1] = TRUE
   else
     if inc[0] == TRUE
       edges[nedge] = [p1, p2]
       edges[nedge + 1] = [p2, p3]
       edges[nedge + 2] = [p3, p1]
       nedge = nedge + 3
       triang[j - 1] = triang[ntri - 1]
       complete[j - 1] = complete[ntri - 1]
       j = j - 1
       ntri = ntri - 1
     end
   end
      end
    end

    # Tag multiple edges
    # NOTE: if all triangles are specified anticlockwise then all interior edges are pointing in direction.
    for j in (1..nedge - 1)
      if edges[j - 1][0] != -1 || edges[j - 1][1] != -1
        for k in ((j + 1)..nedge)
          if edges[k - 1][0] != -1 || edges[k - 1][1] != -1
       if edges[j - 1][0] == edges[k - 1][1]
         if edges[j - 1][1] == edges[k - 1][0]
           edges[j - 1] = [-1, -1]
      edges[k - 1] = [-1, -1]
         end
       end
     end
        end
      end
    end

    # Form new triangles for the current point. Skipping over any tagged adges. All edges are arranged in clockwise order.
    for j in (1..nedge)
      if edges[j - 1][0] != -1 || edges[j - 1][1] != -1
        ntri = ntri + 1
   triang[ntri - 1] = [edges[j - 1][0], edges[j - 1][1], i - 1]
   complete[ntri - 1] = FALSE
      end
    end
  end

  # Remove triangles with supertriangle vertices. These are triangles which have a vertex number greater than NVERT.
  i = 0
  while i < ntri
    i = i + 1
    if triang[i - 1][0] > nvert - 1 || triang[i - 1][1] > nvert - 1 || triang[i - 1][2] > nvert - 1
      triang[i - 1] = triang[ntri - 1]
      i = i - 1
      ntri = ntri - 1
    end
  end
 
# Verbose
Sketchup.set_status_text("Triangulation terminee: "  + ntri.to_s + " triangles crees.")

  return triang[0..ntri - 1]

end

@+

Christophe
Contenu sponsorisé

MessageContenu sponsorisé

Page 3 sur 3 Précédent  1, 2, 3

Voir le sujet précédent Voir le sujet suivant Revenir en haut

Créer un compte ou se connecter pour répondre

Vous devez être membre pour répondre.

S'enregistrer

Rejoignez notre communauté ! C'est facile !


S'enregistrer

Connexion

Vous êtes déjà membre ? Aucun soucis, cliquez ici pour vous connecter.


Connexion

 
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum