We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

Archicad C++ API
About Archicad add-on development using the C++ API.
SOLVED!

GDL projected Fill in 2D

Sam Parish
Booster

Hi, 

 

I'm new to GDL, trying to create some basic objects for the office and am struggling to get the 2D symbol to work how I want it. I am currently using project2{3}  with method 3 +32 to show the top view of the object with the custom hotspots I setup in 3D unfortunately this only seems to show the contours and not the fill.

 

The best way to achieve what I want is to set the fill to background fill then set the background fill pen in project2{3} to white. Is this how it would typically be done or is there a better method? 

 

Looking at most of the inbuilt Archicad objects they use 2D scripting to define the shape. I could do this on this particular object as it is just a couple of rectangles but i want to add options so that I can include attachements or different install variations for the object and I believe I would have to code separate 2D elements for each of these. Similarly for a particularly complex element it is more complex to code the 2D shape so I thought project would be the preferred method.

 

Any tips or advice would be appreciated.

ArchiCAD 24 NZE FULL
Windows 10 Pro 1909
Intel Core i7-6700; 32GB RAM; AMD RX480
1 ACCEPTED SOLUTION

Accepted Solutions
Solution

In my experience don't project other than to check your 2d code. 

Projections cost lots of computing power.

 

Always code the 2d for speed. It takes longer sometimes but is well worth it in the end.

View solution in original post

7 REPLIES 7
Solution

In my experience don't project other than to check your 2d code. 

Projections cost lots of computing power.

 

Always code the 2d for speed. It takes longer sometimes but is well worth it in the end.

DGSketcher
Legend

@Sam Parish See if this guidance clarifies your problems... PROJECT2{3} 

 

I agree with @SenecaDesignLLC that if you can code a 2D script it is a more efficient solution, BUT I also appreciate that some 3D modelling is a bit challenging to translate to 2D, which is why we have the series of Project2 commands. I have some complex objects that rely on the Project2{4} command in order to display correctly using the Floor Plan Cut Plane settings. The prospect of covering all the variations in a 2D script would scramble my brain and I haven't seen a material slowdown when using these objects. It also worth noting that Param-O is also taking the "lazy" way out and using Project2 for it's plan projections. So don't feel too bad about using it as a solution.

Apple iMac Intel i9 / macOS Sonoma / AC27UKI (most recent builds.. if they work)

I may have to start using them again, maybe they have been refined.  I haven't used a project in 2d since v22.

I think the biggest thing to think about with projecting is if you need a cut plane view, and how many instances of the object will those be, and how complicated is it.

If you place numerous complex objects with project, at least it used to slow down my machine, at some point it will have an effect.

Especially with looped polyline objects.

 

Interesting that param o doesn't generate 2d. But I suppose understandable if it's not affecting the drawing that much.

 

I would code a basic 2d option into a model view tab so you could at least have control of it does start to affect your performance.

@SenecaDesignLLC The problem with Project2{4} is it only shows one cut material at the slice line, so you need to run Project2{4} once for each material and hide all the other elements in the 3D model using a different material. It can be done with IFs and I typically use 8 materials in my objects without problem. It would be nice if we had Project2{5} that responded to top & bottom cut plane input and showed the cut material fills without the need for looping... 

Apple iMac Intel i9 / macOS Sonoma / AC27UKI (most recent builds.. if they work)
Jman
Enthusiast

If you planing to use this object more than one time then you should script 2d.

Sounds like something super complicated, but it is not. After one object you will become expert.

The simplest method I am using not only to fix objects but also make new.

If you have made this object by modelling on floor plan and saving it as object then make sure it was saved as object attached to Archicad origin. 

1.  open the object 

2. in Details push button Select Subtype and select the subtype from Subtype Hierarchy. When you do that open Parameters. You will find there new parameters in blue colour, they are default parameters for this subtype. They start usually with gs_ name. Explore the gs_2D_representation subgroup,  all parameters responsible for 2D are there. Important to use always those parameters in 2D script and add new 2D parameters to this sub group.

3. open 2D script of your object. Make sure that you have Project2 2, 270, 2 on the top of 2D script. If there is anything else then select all and push Comment button, this will temporary disable existing script.

4. open 2D View window. Push Undock Tab and move that window to side. 

5. open 2D Symbol window. There shouldn't be anything if you have made this object from floor plan. 

6. select all in 2D View window and copy and paste to 2D Symbol window. 

7. in 2D Symbol window redraw object with fills. Use Drafting fill for outlines and Cut Fill if you have any part of object in cut view. Simplify drawing as much as you can. 

8. open 2D script window next to 2D Symbol window. Select one fill  and Command D or Control D (drag) to 2D script window. It sold look like print screen below. poly2 script on top is responsible for fill, poly2 under set_line is responsible for outline. 

Screen Shot 2021-10-27 at 12.21.35.png

9. now if you want to keep script short and be able to understand what is what

type above copied script

!!!!!!!!!!!! name of the part of the object

and replace in script fixed values with parameters

 

pen  gs_cont_pen 

fill gs_fill_type

poly2_b (5)     5,   3,   1,   3,   gs_fill_pen,   gs_back_pen,

Screen Shot 2021-10-27 at 13.29.33.png

gs_cont_pen = outline of fill pen

gs_fill_type = fill type

= fill with outline, 2 = just fill, 1 = just outline

gs_fill_pen = hatch pen

gs_back_pen = fill background pen

number 33, in the end of numeric lines = cut line, number 1, = outline. Those lines will do differently on plan but will print as pen assign to them.

if you want to have control over the outline type than copy and paste set_line_type "solid" above pen gs_cont_pen line and change "solid" to gs_outline_type Add this new parameter to parameter list

 

Screen Shot 2021-10-27 at 13.26.30.png

 

10. You can delete second poly. Check Script and if all is ok, open 2D View and select part you have just scripted in 2D it should show fill. From now on you will be able to change outline, fill and pens of that part.

11. Add rest of the object fills one by one and add labels to parts in 2D script for clarity if all object uses the same fill you don't need to change 

12. open your 2D script and check the Commented script for 

mull2 A/0.00 , B/0.0

add2 0.00 , 0.00  

copy and past on top of 2D script those two lines and delete rest of commented text. Those two line are responsible for location of your object also changes of size

13. check script for errors , test if 2D match 3D after changing width and length. There might be some distortions because object is saved with fixed sizes so only length and width will change in 2D

14. in 2D window select Project2 2,270,2 and comment. This will switch 3D in 2D. You can live or delete drawings in 2D Symbol window

 

When you do couple of objects this way all process will become super easy. Next step will be to script 3D by converting poly to prism in 3D window. 

 

Good luck

 

 

user since A3
Jman
Enthusiast

Hi 

I did just play with your object and add some to 2D script using copying and pasting polys plus adding 'minimum space' switch on by MVO. I hope it will help you with next object. 

Good luck

user since A3
Sam Parish
Booster

Thanks all,

 

Looks like I will getting some 2D practice in. It's good to know that that should be the go to.

ArchiCAD 24 NZE FULL
Windows 10 Pro 1909
Intel Core i7-6700; 32GB RAM; AMD RX480