# How do i plot a 3D structure as in the attached picture?

6 views (last 30 days)
Ni2 on 16 Oct 2019
Commented: Ni2 on 17 Oct 2019 I want to plot a mesh like in the attached picture.
1. Lengths of each sides are specified ( L and W) 2. Number of horizontal and vertical lines are fixed ( m and n) 3. Distance between parallel lines are same (d1 and d2) 4. Perpendicular legs all have same length(H) 5. Perepndicular legs are placed at various intersections depending upon some condition.

Sulaymon Eshkabilov on 16 Oct 2019
Your attached picture is not there. Could you post it?
Fabio Freschi on 16 Oct 2019
Is there a specific criterion for the position of vertical legs?
A curiosity: is it a grounding system for an electrical installation?
Ni2 on 16 Oct 2019
Yes i m trying to do substation grounding design.
1. These legs should only be present in the intersections of the horizontal and vertical lines.
2. Number of legs is predetermined variable.
3. It can either be only in the perimeter or only inside the perimeter depending on some condition.

Fabio Freschi on 16 Oct 2019
Edited: Fabio Freschi on 17 Oct 2019
I share with you a couple of function that I use to plot grounding grids. They are attached. Then you can use the following script to plot the grid
clear variables, close all
% setup grid params
lx = 20; % x edge length
ly = 20; % y edge length
lz = 2; % z edge length
nx = 10; % divisions along x
ny = 10; % divisions along y
hz = -2; % z translation
% grid creation
% P: points coordinates (z = 0, translate as needed)
% E: edge connectivity
[P1,E1] = createGrid(lx,ly,nx,ny);
% vertical rods: we can use createGrid but we change the connectivity
[P2,~] = createGrid(lx,ly,nx/2,ny/2); % note that nx/2 and ny/2 are integer
nP2 = size(P2,1);
% we must add points with the same x,y coordinates of P2 and -lz as z
P2 = [P2; P2(:,1:2) -lz*ones(nP2,1)];
% connectivity
E2 = [1:nP2; nP2+1:2*nP2]';
% merge
P = [P1; P2];
E = [E1; E2+size(P1,1)];
% translation
P(:,3) = P(:,3)+hz;
% plot
figure, hold on, axis equal
patch('Faces',E,'Vertices',P,'EdgeColor','k','LineWidth',2);
view([1 1 1])
% transparent frame
Q = [-lx -ly 0; lx -ly 0; lx ly 0; -lx ly 0];
F = [1 2 3 4];
patch('Faces',F,'Vertices',Q,...
'EdgeColor','k','LineWidth',1,'FaceColor','r','FaceAlpha',0.2);
EDIT: I added the grid translation of hz in vertical position

Ni2 on 17 Oct 2019
i am not sure.
and i wanna plot L-shape grid also whose outer length/width is L1/W1 and inner(missing part) length/width is L2/W2. how would u suggest me to do that.
Fabio Freschi on 17 Oct 2019
The files I shared can be used only for rectangurale grids. For an L-shaped grid you can add two regtangular grids and remove the coincident nodes/edges
Ni2 on 17 Oct 2019
I dont know codes to subtract missing part :(