Filtering classes in Document Composer

I have finally gotten around to learning how to create custom templates for the document composer. The documentation is a bit challenging but mostly I’ve figured out the easy things.
One thing stumping me so far is how to filter the classes from a class diagram to include only those classes that are defined in the same package as the diagram itself. In other words, the diagrams have reference views of some classes defined in other packages and I would like the iteration through the classes to skip those views.

In pseudo-code, it would look like:

set diagramParent = .parent
for each class
if class.parent == diagramParent
print class documentation
end if
next class

Any ideas on how to accomplish this are much appreciated.
Thanks,
Bob

Sorry, it is not supported to define a variable via running the template.
(It is a good feature, I think we will support it.)

But now, I think you may use Master/Auxiliary view to filter other package’s classes.

Hopes this solution is working on your case.

This works well for my use case.

Thank you!