.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Block Reference Hatch - Deleting loops within a Hatch

1 REPLY 1
Reply
Message 1 of 2
DouceDeux
740 Views, 1 Reply

Block Reference Hatch - Deleting loops within a Hatch

Hello all!

 

I want to be able to add a Block Reference to a hatch.

I'm adding the block reference to an ObjectIdCollection and the hatch is not taking it when using AddLoop().

So I thought maybe I needed to add the location of the polyline (curve-like) object that is member of the blockreference to the hatch, but I don't know how to get its ObjectId.

 

Hatch thisHatch = new Hatch();
thisHatch.Layer = layerName;
thisHatch.SetDatabaseDefaults();
thisHatch.SetHatchPattern(patternType, patterName);
thisHatch.Color = Color.FromColorIndex(ColorMethod.ByColor, colorIndex);
thisHatch.Transparency = new Transparency((Byte)(255 * (100 - 60) / 100));

tSpace.AppendEntity(thisHatch);
transaction.AddNewlyCreatedDBObject(thisHatch, true);

thisHatch.Associative = true;
                
ObjectIdCollection newOIC1 = new ObjectIdCollection();
newOIC1.Add(hatchElement);
thisHatch.AppendLoop(HatchLoopTypes.Default, newOIC1);
ObjectIdCollection newOIC2 = new ObjectIdCollection();
newOIC2.Add(laLosa);
thisHatch.AppendLoop(HatchLoopTypes.External, newOIC2);
thisHatch.EvaluateHatch(true);
                
ObjectIdCollection newOIC3 = new ObjectIdCollection();
newOIC3.Add(thisHatch.ObjectId);
newDOT.MoveToBottom(newOIC3);

 

 

Also, I'm trying to delete certain HatchLoop that is associated to a polyline but I don't know how to do it. I'm going through the loops in the hatch but I don't know what to do there. I wanna do this so I create a new and different hatch on top.

I think one could also copy all the loops except the one one wants to delete, but I'm not sure how to tell which one is the one I want to delete that is the one associated to a polyline or that is in certain region.

 

Thanks in advance.

 

 

1 REPLY 1
Message 2 of 2

You can clone polyline, transform it with BlockReference.BlockTransform matrix and use this clone as a hatch loop.

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"


Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Expert Elite Member

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost